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

[FEATURE] Add a warning when parsing the same header twice for one row #276

Closed
lkappeler opened this issue Aug 5, 2019 · 1 comment
Closed
Assignees
Labels
enhancement in release When a feature is merged in to the release branch parsing
Milestone

Comments

@lkappeler
Copy link

Lost data and debugged the parser. It turned out I had the same header name twice inside my CSV
I noticed some difference in the input and output of the parsed file, after some investigation I figured out some fields like description, usually containing html with line breaks where empty. Looked in the parser code, as I expected some errors with the line breaks inside the parsed value. How ever the parser works great and I found no Issues with parsing the content properly. It turned out that I used the same header multiple times ( from joining some tables to generate the CSV), therefore the first value was overwritten with the second one which is usually empty.

Describe the solution you'd like
A warning would be nice when a already set property on the row gets overwritten. Probably somewhere here. Further more a option could be introduced to rename the header if he already exits.

@doug-martin doug-martin added this to the v3.7.0 milestone Dec 19, 2019
@doug-martin doug-martin added the in release When a feature is merged in to the release branch label Dec 21, 2019
@doug-martin doug-martin mentioned this issue Dec 21, 2019
@doug-martin
Copy link
Contributor

I changed fast-csv to emit an error when duplicate headers are encountered. If you would like to transform them to prevent duplicates headers now accepts a function to transform them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement in release When a feature is merged in to the release branch parsing
Projects
None yet
Development

No branches or pull requests

3 participants