Quantcast
Channel: Excel Data Reader - Read Excel files in .NET
Viewing all articles
Browse latest Browse all 448

Commented Unassigned: Numeric strings are converted to numbers [13688]

$
0
0
When reading an .xlsx sheet with IExcelDataReader.AsDataSet strings that only contain numbers are converted to decimals
like 0100 becomes 100.0
If I use ' to force a string it works.

I would be greatful for a quick update.
Comments: ** Comment from web user: sholle **

How you format the cell data type does NOT effect the data stored in the cell. If the data is stored as a numeric type it will come out as a decimal type. As far as I know, the reader has no way to determine what formatting you have put on that cell. The formatting is only for viewing in excel, not modifying the stored data. The way you can tell what the underlying excel data looks like is to change the cell to text.

All you have to do is convert 100.0 into whatever format you want once you read it out. Whatever language you are using when you read the data has information on the web on how to turn a numeric value into a formatted left justified 0 filled string. Formatting the excel sheet to look different will not help you at all.


Viewing all articles
Browse latest Browse all 448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>