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

Column headers with the non unique names are replacing each other #218

Open
sjorsjes opened this issue Jul 22, 2022 · 0 comments
Open

Column headers with the non unique names are replacing each other #218

sjorsjes opened this issue Jul 22, 2022 · 0 comments

Comments

@sjorsjes
Copy link

  • Operating System: Windows
  • Node Version: v16.15.0
  • NPM Version: 8.5.5
  • csv-parser Version: I'm using neat-csv version 7.0.0

Expected Behavior

const csv = 'type,part,part\nunicorn,horn,eye\nrainbow,pink,tail';

console.log(await neatCsv(csv)); // [{type: 'unicorn', part: 'horn', part_1: 'eye'}, {type: 'rainbow', part: 'pink', part: 'tail'}]

When importing a CSV file with non unique header names into Excel it will add _#. In this example it will create the following headers: type | part | part_1

Actual Behavior

const csv = 'type,part,part\nunicorn,horn,eye\nrainbow,pink,tail';

console.log(await neatCsv(csv)); // [{type: 'unicorn', part: 'eye'}, {type: 'rainbow', part: 'tail'}]

It looks like it overrides the previous column with the same header name.

How Do We Reproduce?

Use the examples from above or see this sandbox
https://codesandbox.io/s/read-file-node-ejs-forked-pqmqrm?file=/src/index.js

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

No branches or pull requests

1 participant