The tool says the problem is in row 5, but line 5 in my editor looks fine. Where is the error really?

The tool counts records, not lines. The header is row 1, and a line break inside a quoted cell does not start a new row. So if earlier cells hold two-line addresses, the problem row sits further down in your editor than its number suggests. Search by the row's values instead of counting lines.

Published · 3 min read

A file with two-line addresses

Here is a small customer file. Sara's and Laila's addresses are written over two lines inside quotes, which CSV allows. At the end is a row with an extra value:

name,address Sara,"Riyadh Olaya St" Omar,Dubai Laila,"Jeddah, Tahlia" Bad,x,y

Converted, the tool said: 'Row 5: has 3 fields but 2 were expected.' Open the file in a text editor and go to line 5, though, and you find Laila,"Jeddah, which is perfectly fine. The row it means is Bad, on line 7.

How rows are counted

  • Row 1: the header, name,address.
  • Row 2: Sara, spanning lines 2 and 3 because the address has a line break inside the quotes.
  • Row 3: Omar, on line 4.
  • Row 4: Laila, on lines 5 and 6.
  • Row 5: Bad, on line 7.

Every quoted cell with a line break adds a line in the editor without adding a row. With each such address the line number drifts one step further from the row number. In an order file with hundreds of two-line addresses, the gap can run into the hundreds.

The fastest way to find the row

  1. Convert the file in the CSV and JSON converter despite the note; notes do not stop the conversion.
  2. In the JSON output, look for the object containing the key __parsed_extra, or the one with a missing field. It holds the values of the row in question, such as the name Bad.
  3. Search for that value in your text editor to land on its real position.
  4. Fix the row, save, convert again and check the note has gone.

What if the error is about quotes?

Quote errors, such as a field that never closes, stop the conversion entirely, so there is no output to search. Then it helps to remember the rule: the real record is at the line matching the row number or further down, never above it. If you have an earlier clean copy of the file, comparing the two in the Text comparison shows which line changed.

Does this mean line breaks in cells are a problem?

No. A two-line address is a valid value, and the tool keeps it in the JSON with the line break, so Sara's address becomes 'Riyadh', a new line, then 'Olaya St'. The only thing that changes is the numbering, so count records, not lines.

Common questions

Is the header counted in the numbering?

Yes. The header is row 1, so the first data record is row 2.

What if I untick 'First row holds column names'?

Then numbering starts at 1 on the first data line.

Are blank lines counted?

Completely empty lines are skipped, so they do not enter the data.