mholt / PapaParse

Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input
http://PapaParse.com
MIT License
12.3k stars 1.14k forks source link

How to add empty string as value so that all rows have the same number of fields #1053

Open sp88011 opened 2 months ago

sp88011 commented 2 months ago

I'm trying to solve the error `Too few fields: expected [10] fields but parsed [8].

Ultimately, the csv I'm looking at has indeed too few fields for certain rows. That is because usually when saving a csv, trailing empty values in are omitted in a given row.

Is there any way to add empty strings ("") to any trailing empty field to ensure each row has the same number of fields? We know how many fields are expected by passing a header.