mike_x_
mike_x_

Reputation: 1929

How to read from excel cell display value without evaluating formula with ClosedXML

I have an excel file and I want to import its data to a web application using ClosedXML.

Now I am using this to read a date as string:

var validFrom = ((DateTime)row.Cell("B").Value).ToString("d/M/yyyy");

and this to read a decimal as string:

var price = row.Cell(letter).Value.ToString();

In order for this to work I have to copy paste-as-values-only from excel and then import the file to my app. Formulas contain filepaths from remote excel files that are not accessible from the server or function that are not working with ClosedXML (such as VLOOKUP).

How can I read data as displayed without re-evaluating the formula?

Upvotes: 2

Views: 2920

Answers (1)

Francois Botha
Francois Botha

Reputation: 4839

You can use the cell.CachedValue property to look up cached values.

Upvotes: 3

Related Questions