How to get the Value of a Formula cell

Topics: Developer Forum
Oct 3, 2008 at 12:59 AM
Does anyone know how to get the Value of a Formula cell. When I tried worksheet.Cell(row, col).Value on a cell with formula, all I get is a empty string. I have created a xlsx file from a template with formula and I want to display the result on a web page. I don't want to redo the work already done by the xlsx file. Thanks in advance.
Oct 13, 2008 at 5:07 PM
If I understand correctly, you entered values into cells and then a formula (probably referencing those cells) into another cell and you want to see the result of that formula? For the result to be calculated to need to open the xlsx file with Excel. On load, Excel (by default) calculates all cells which have a formula and sets their value to the calculation result. ExcelPackage only lets you write and read SpreadsheetML files.
Nov 26, 2008 at 10:41 PM

xlPackage.Workbook.Worksheets[i].Cell(j, k).Value
xlPackage.Workbook.Worksheets[i].Cell(j, k).Formula

if you're getting a blank value, double check you're looking at the right cell, remembering that the i,j, and k are 1-indexed, not 0-indexed.