-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
I can't tell if this is intentional, but I am using ExcelDataFactory.CreateCsvReader(fileStream) and when I read a .csv file that contains a space:
Header1,Header2,Header3
value1, ,value3
It is automatically trimmed, so that when I store the value in a string, instead of the value being a literal space, it is an empty string. The workaround is to ensure the value is set as a literal space in the .csv file like so:
Header1,Header2,Header3
value1," ",value3
If you take a look an alternative tool, like the Microsoft.VisualBasic.IO.TextFieldParser, it allows for the TrimWhiteSpace bool to be set to true or false. Setting it to false will cause a value like , , to be read as a literal space.