← CSV Repair & Deduper (offline browser tool)

How to fix 'unexpected end of data' CSV parser errors

A practical way to find an unclosed quote, embedded line break, or truncated final row when a CSV parser reports unexpected end of data.

Before you work through this by hand: you can check your own CSV free and see which of these problems your file actually has — duplicate rows, near-duplicates, broken quoting, encoding damage. It runs in your browser tab, nothing is uploaded, and there's no signup or email.

What the error usually means

An unexpected end of data or EOF inside string error usually means the parser saw an opening quote and reached the end of the file before finding the matching closing quote. A copied line break inside a field, a quote pasted into a note, or an incomplete download can create the same symptom.

1. Preserve the original and inspect the last rows

Make a copy before editing. Open the copy in a plain-text editor and inspect the final few records. A file that ends halfway through a quoted address, note, or description is not safely repairable by guessing; re-export or re-download it from the source if possible.

2. Check quoting before changing delimiters

CSV fields may contain commas or line breaks when they are enclosed in matching double quotes. Do not delete every quote or replace every comma: that can turn one valid field into several columns and lose the original meaning. Look for a quote that starts a field without a closing quote, or a literal quote that should have been doubled as "".

3. Let a strict parser identify the bad record

Python's standard library can expose the failure without rewriting the file:

import csv
with open("copy.csv", newline="", encoding="utf-8-sig") as f:
    for row_number, row in enumerate(csv.reader(f, strict=True), start=1):
        pass

If the encoding is the problem instead, try the documented Windows-1252 fallback on a copy. If the parser accepts the file but rows have different field counts, inspect those rows separately: an unquoted delimiter inside text is a shape problem, not an end-of-data problem.

4. Validate the repaired copy

After a source re-export or a carefully reviewed repair, compare the header and row count with the source system, confirm the final record is complete, and spot-check fields containing commas, quotes, and line breaks. Keep the untouched export until the cleaned file has imported successfully.

This is one of the cases where a local review tool is useful: it can detect delimiters and encoding, flag malformed row shapes, and show the parsed preview before you export. It should never silently drop a row to make the error disappear.

See also: our broader broken-CSV guide, the encoding guide, and the backup/versioning guide.

$19 one-time payment. No subscription. If you'd rather skip the manual steps above, CSV Repair & Deduper (offline browser tool) automates the duplicate-finding and review step for you, entirely on your own device.

See CSV Repair & Deduper (offline browser tool) — $19 one-time

See all free guides