I have an Excel file (.xlsx), that I open in C# via Spreadsheet Light.
Some Cells can have the value #N/A
(or whichever representation your language version of Excel uses) as a result of an SVERWEIS
(in German, I think it is VLOOKUP
in English).
What is the proper way to detect this cell error via SL? I currently check, if the string representation of the cell is "#N/A", which is most probably not the best way to do it. Is there any "correct" check, that I missed?
What I currently do:
using(SLDocument doc = new SLDocument(filename))
{
if(doc.GetCellValueAsString("A11") != "#N/A")
//Do error handling here
}
What I would like to do would be more like:
using(SLDocument doc = new SLDocument(filename))
{
if(doc.HasCellError("A11")) //This function doesn't exist (yet?)
//Do error handling here
}
This would eliminate the hackish looking solution with the magic string #N/A
.