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

CSV columns repeat in v3+ when optional columns prop not included #411

Open
joerichards121 opened this issue Apr 25, 2024 · 0 comments
Open

Comments

@joerichards121
Copy link

/*
 *  Let data be a long array of objects containing the same keys 
 */
let data = [
   { k1: v1, k2: v2 }, 
   { k1: v3, k2: v4 }, 
   { k1: v5, k2: v6 }, 
   ...
]
 
/* 
 *  Let CsvDownloader be initialized as so 
 */
<CsvDownloader filename='fileName' datas={data}>
  <Button>Download</Button>
</CsvDownloader>

Upon upgrading react-csv-downloader to v3, we noticed the created .csv file contains repeated columns when opened in excel. For example,

k1 | k2 | k1 | k2 | k1 ..
v1   v2   v1   v2   v1 ..
v3   v4   v3   v4   v3 ..
v5   v6   v5   v6   v5 ..
..   ..   ..   ..   ..

This bug is not present in version 2.9. It appears that supplying columns prop fixes the bug.

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