Read excel cell value using Closedxml

Sep 8 2016 2:27 AM
Hi,
I am using closedxml to read excel 2013(.xlsx) file. The excel sheet have formula cell with in. I am not able to read particular cell as this has long formula. Currently using below code to read the cell value.
 
foreach (IXLCell cell in row.Cells())
{
if (cell.HasFormula)
dtable.Rows[dtable.Rows.Count - 1][i] = cell.ValueCached;
else
dtable.Rows[dtable.Rows.Count - 1][i] = cell.Value.ToString();
i++;
}
 
The particular cell value is - 3. I want to retrieve the value 3 and assign to datatable. Please provide if any solution for this.
 
Also let me know if there any way to fill worksheet values to datatable in one stretch. 
 
Thanks. 

Answers (1)