
When I try to read excel sheet having formula, I get the result as 0. C4 has the formula as =SUM(C2:C3)
using (var package = new ExcelPackage(existingFile))
{
ExcelWorkbook workBook = package.Workbook;
var currentWorksheet = workBook.Worksheets.First();
currentWorksheet.Cells["C2"].Value = 5;
currentWorksheet.Cells["C3"].Value = 7;
var c4 = Convert.ToDouble(currentWorksheet.Cells["C4"].Value);
}
In the above code why is c4 getting the value of zero?
Please help. Thanks



EPPlus does not have a calculation engine built into it, so it won't calculate a cell's value if it happens to have a formula in it. You can get the formula from the cell via the CellRange.Formula property as opposed to the CellRange.Value property.


Developer
Jan 21, 2014 at 7:07 PM

Next version of EPPlus will have a calculation engine. A beta will be available in the near future.

