Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PapaParse Errors explanation

Tags:

papaparse

I'm using papaParse to parse an CSV file into JSON for further use. Upon parsin it returns

"errors": [ { "type": "FieldMismatch", "code": "TooFewFields", "message": "Too few fields: expected 21 fields but parsed 1", "row": 14 } ], "meta": { "delimiter": ";", "linebreak": "\r\n", "aborted": false, "truncated": false, "fields": [ "Output in top 10 percentiles (%)", "Overall", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014" ] } }

can somebody please explain to me what this means? I read trough the documentation on their webpage but still don't understand what is wrong

the CSV file I'm working with is this (http://www.topdeckandwreck.com/excel%20graphs/Sheet10.csv)

like image 274
Miha Šušteršič Avatar asked Jun 06 '26 15:06

Miha Šušteršič


2 Answers

In your config, add

skipEmptyLines: true

Reference: http://papaparse.com/docs#config-details

like image 60
Stéphane Laurent Avatar answered Jun 10 '26 15:06

Stéphane Laurent


Solution was posted by Lasse V Karlsen in the comments, removing the last empty line in notepad so the CSV file contains only data removes the error

like image 23
Miha Šušteršič Avatar answered Jun 10 '26 14:06

Miha Šušteršič



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!