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

Header columns in double quotes ends up with an InvalidQuotes error when I dont think it should #1003

Open
tturnerswdev33 opened this issue Jun 1, 2023 · 1 comment

Comments

@tturnerswdev33
Copy link

If you fetch this csv file using the url to the file, then use response.text() it returns the entire CSV inside of a pair of double quotes. If the column headers are already double quoted (because excel tends to do that on save as csv) then PapaParse gives no data and yields repeated InvalidQuotes errors.

This format is very common so I am surprised it does not work. It's like PP sees the begin quote of a string and parses that as a double quote... as well as the ending double quote.

If I preprocess the text sent to papaparse to remove all the header double quotes, then it breaks if there is a comma in that header since the cols are delimited by commas.

I have attached the file if you want to try it.

pparse-double-quote.csv

@tturnerswdev33
Copy link
Author

Here is a sandbox showing one solution. We had to convert commas for the csv delimiter to a pipe, then use that as the delimiter into papaparse. That gets around all the issues with papa.parse seeing a comma in the header cols as a new column when it's just part of a string. https://codesandbox.io/s/stupefied-saha-fp2vh6

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