-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
It is common practice in our product for data to include leading zeros,
For example, a barcode must always be 16 numbers long so it may include some leading zeros when necessary.
In some cases, our customers will use a custom format in Excel to force this syntax:

In most cases, the numbers are just stored as "Text" instead of a numeric format.
NOTE: When storing numbers with leading zeros as "Text" formatted data, Excel stores the entire number preceded by an apostrophe:

Our API presently uses the following configuration for the reader:
var reader = ExcelReaderFactory.CreateReader(stream)
var dataSet = reader.AsDataSet(new ExcelDataSetConfiguration()
{
UseColumnDataType = true,
ConfigureDataTable = (tableReader) => new ExcelDataTableConfiguration()
{
EmptyColumnNamePrefix = "EmptyColumnName",
UseHeaderRow = true,
}
});
The output of the AsDataSet() method includes the property value, but without the leading zeros.
For example, 0000123456 is returned as 123456.
h2.Expected
If the data in an Excel file shows the leading zeros, the AsDataSet() method should return them as such.
I would expect this to be the case whether this is by custom format or when a number is stored as "Text" in Excel.