Error while parsing a valid CSV with a newline at the end
See original GitHub issueSteps to reproduce:
-
Create a file with content (make sure that there is a newline after “1,2”):
a,b 1,2
-
Set
header=true
-
Try to parse the file …
-
First error:
Object {type: "FieldMismatch", code: "TooFewFields", message: "Too few fields: expected 2 fields but parsed 1", row: 1}
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Ruby CSV does not understand \r\n as row end - Stack Overflow
I can think of various workarounds, such as reading the file in first, chomping the ends, then processing the array with CSV, but...
Read more >5 most common parsing errors in CSV files (and ... - Medium
When processing a CSV file with CRLF line endings it is not unusual to find an undesirable ^M (or CR) character at the...
Read more >Common CSV Template Error Messages and How to Fix Them
An error message that begins “Failed to parse file” indicates that the uploaded CSV file is invalid in some way. Watershed supports UTF-8 ......
Read more >How to parse a file with newline character, escaped with \ and ...
Hi! I am facing an issue when reading and parsing a CSV file. Some records have a newline symbol, "escaped" by a \,...
Read more >Parsing .csv file and getting the error "Found No valid record "
It is some issue with your FFSchema it self not matching to your csv file while parsing. Did you select the Nth Field...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the report. But that’s not a bug. Try the
skipEmptyLines
config option. Otherwise the line has to be interpreted as data, and the data doesn’t have enough fields to fill out the header row. You could also try disabling header row which doesn’t do field counts.See also #154 and #150 which are related/same.
Some applications interpret empty lines to indicate missing record. It isn’t Papa’s job to assume that empty lines are meaningless. But you are welcome to enable that assumption with
skipEmptyLines
.