How browsers word it
| Python csv, strict=True | unexpected end of data |
|---|---|
| Python csv, default | No error: the rest of the file becomes one value |
Common causes
A quote that opens and never closes
The value for Ann starts with a quote, so the reader treats the next line break and everything after it as part of that value, up to the end of the file.
Input
name,note Ann,"unclosed Bob,ok
CSV JSON says
Quoted field is never closed. The quote opened in row 2, column 2 (line 2) has no closing quote
A file that was cut off
An interrupted download or export can stop in the middle of a quoted value. The last line then has an opening quote and no end.
Input
id,note 1,"a note that was cut
CSV JSON says
Quoted field is never closed. The quote opened in row 2, column 2 (line 2) has no closing quote
Quotes doubled inside a value
To put a quote inside a quoted value, write it twice. The reader turns each pair into one quote.
Input
name,note Ann,"said ""hi"""
CSV JSON says
[{"name":"Ann","note":"said \"hi\""}]A line break inside a closed value
A line break inside a pair of quotes is fine. It is part of the value, not the end of the row.
Input
name,note Ann,"line1 line2"
CSV JSON says
[{"name":"Ann","note":"line1\nline2"}]
How to fix it
- Go to the line named in the message and add the missing closing quote, or delete the quote if the value was never meant to be quoted.
- Write a quote inside a quoted value as two quotes: "".
- If the file was cut off, export or download it again.
- Let the program that writes the file do the quoting instead of joining text by hand.
- Paste the text into the CSV JSON converter: it names the row, column and line where the unclosed quote starts.