CSV Parsing fail when extra cell with no column
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 4.3k
- Forks
- 299
- Avg merge
- 16h 19m
- Merged PRs (30d)
- 1
Description
Describe the bug
I'm trying to parse an ugly csv file, I got extra values on some records, here is an example :
Line 2 is failing because there is an extra value in this record. Expected 2 got 3
"name","address"
"Bihl Christian","16","Rue De Kingersheim 68270 Wittenheim France"
"Levy Guilene","1 Rue D Ottmarsheim 68170 Rixheim France"
{
"code": "CSV_RECORD_INCONSISTENT_COLUMNS",
"message": "Invalid Record Length: columns length is 2, got 3 on line 200"
}
To Reproduce
parse(csv, {
columns: true,
delimiter: [","],
})
How can I clean ugly CSV file and success to parse this CSV by removing ugly data.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the parse(csv, { columns: true, delimiter: [","] }) reproduction and inspect how inconsistent record lengths are handled. Clarify whether the intended result is an option or behavior for discarding the extra value, then add coverage for the shown CSV and verify parsing succeeds without the unwanted cell.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100