I use ClosedXML to read data from an excel file. Specifically I use cell.GetString() to get a value from a cell. This seems to work fine for all cell types. At least it was until today. Today I got an excel file that in a cell with type Text contained a
number 159. When I read the cell via ClosedXML I get back a value of ‘@’ (without the quotes, just an “at sign” symbol). I did some pocking around with the debugger and looking at the source XML file for the sheet and it appears that
the cell is somehow corrupted. I say this because in the debugger I see that the cell object already has value ‘@’ , DataType is Text, and ShareString is set to true. But in the XML file for the cell I see that it is not presented as a string:
<c r="B2" s="27">
Some other cells that work properly have t=”s” attribute and do use shared values like:
<c r="B17" s="27" t="s">
I tried using the apostrophe before the value and changing cell type to Generic but this did not help.
I do not really think that this is a problem with ClosedXML software itself but was wondering if someone by any chance had the same problem and found a workaround or perhaps the reason why a cell would get in a state like that.
Thanks in advance for your help,