CSV row has a different column count: what it means (and how to fix it)
A common conversion error: “Row N has X columns, but header has Y.” This usually isn’t random—it’s a parsing mismatch caused by delimiter or quoting.
What the error actually indicates
Converters treat the first row as a “schema”: the number of columns in the header becomes the expected number of fields for every row. If any row splits into a different count, the data can’t be mapped to a stable object shape, so a strict converter stops.
Top causes (in real files)
- Wrong delimiter: comma vs semicolon vs tab. A wrong choice can collapse columns or over-split.
- Broken quoting: a stray quote can make the parser treat delimiters as literal text (or the opposite).
- Embedded newlines: multi-line fields must be quoted; otherwise a “row” becomes two rows.
- Dirty exports: some systems emit inconsistent rows when data contains separators.
Fast debugging workflow
- Confirm delimiter using the header row and a couple of sample rows.
- Open the failing row (N) and inspect around separators and quotes.
- Look for: unmatched quotes, extra separators, or unexpected line breaks.
- Re-export if possible—clean exports beat manual fixes.
Preventing future mismatches
- Always export with quoting enabled for fields that may contain separators.
- Prefer UTF‑8 exports and keep header names clean and unique.
- Validate a small sample before processing a large file.
Practical checklist (fast)
If you’re stuck, use this quick checklist to narrow the problem before you try “random fixes”. Start by validating the input format (syntax first), then confirm shape expectations (array vs object, headers vs rows). Convert a small sample, inspect the output, and only then export the full result.
- Validate: confirm the input is strict JSON/XML/CSV (no stray characters).
- Confirm shape: arrays vs objects; headers vs row lengths; repeated tags vs arrays.
- Test a sample: first 20–50 rows/items are enough to detect parsing issues.
- Export: copy/download the output and re-check it in the consumer (script/spreadsheet/API).
This workflow is privacy-first by design: All processing happens locally in your browser. Files are never uploaded.
FAQ
Why does the error happen only on some rows? Those rows often contain commas/newlines in text fields, or corrupted quotes.
Should I upload the file to “fix it” online? Avoid uploads for sensitive data—debug locally first.
Trust note: All processing happens locally in your browser. Files are never uploaded.