Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spaces in CSV are automatically trimmed #566

Open
Crazyloon opened this issue Sep 11, 2021 · 0 comments
Open

Spaces in CSV are automatically trimmed #566

Crazyloon opened this issue Sep 11, 2021 · 0 comments

Comments

@Crazyloon
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants