beamworks / react-csv-importer

Uploader + CSV parser + raw file preview + UI for custom user column mapping, all in one
https://www.npmjs.com/package/react-csv-importer
MIT License
231 stars 95 forks source link

Google Sheets is skipping first row #61

Closed jessehanley closed 2 years ago

jessehanley commented 2 years ago

Hey @unframework,

Got a weird one today that our support team ran into: when you export to CSV from Google Sheets and import into react-csv-importer it often skips the first row.

To replicate we head on over to Google Sheets and create a simple spreadsheet with just one row and header:

image

When we export it as a .csv file and import it into our importer it's just blank:

image

If we go ahead and increase it to two lines we run into a similar problem:

image

It skips the first row again:

image

Can't figure this one out. Have upgraded to the latest version of the plugin too. Issue happens on the demo page as well so not just our repository.

Not a big issue and no rush — was just curious if you've come across it?

Appreciate you!

unframework commented 2 years ago

Hey, thanks for reporting this one, it does look sketchy. Should be able to debug this by Wednesday.

unframework commented 2 years ago

Hmm, I looked into this and was able to repro - it seems the final import works ok, but in preview the last line does not show up.

This is because my preview logic assumed that PapaParse just emits entire initial file content as one stream chunk, but it so happens that the last line always gets "flushed out" separately. So, luckily no data loss but it looks broken for small files, of course.

Will get a fix out in next point release (there are a few other streaming/parsing cleanups to release as well).

unframework commented 2 years ago

This should be fixed in v0.6.0, please reopen if this persists. And thanks again for the repro case + screenshots!