Why CSV columns shift after a comma (and how to repair the row safely)
A practical guide to commas inside fields, quoting, uneven row lengths, and review-first repairs when values appear under the wrong CSV column.
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 a shifted column usually means
When a name, note, or address contains a comma and the field is not quoted correctly, a CSV parser may treat that comma as a new separator. The row then has one extra field and every value after it appears under the wrong header. This is a shape problem, not a duplicate-record problem, so deduplicating first can hide the real defect.
Inspect the raw row before editing it
Open the CSV as plain text on a working copy and compare the suspicious row with the header. Look for a comma inside a text value without matching double quotes, an unmatched quote, or a line break that was not kept inside a quoted field. Do not rely on how a spreadsheet happens to display the row: it may silently reinterpret malformed input.
Check field counts with Python
import csv
with open("export.csv", newline="", encoding="utf-8-sig") as f:
rows = csv.reader(f, strict=True)
header = next(rows)
for line_number, row in enumerate(rows, start=2):
if len(row) != len(header):
print(line_number, len(row), "expected", len(header))
A strict parser helps locate malformed rows, but it does not decide what the intended value was. Preserve the original line and ask the source system for a corrected export when the intended boundaries are ambiguous.
Repair and verify a copy
If the intended value is clear, repair the row with a real CSV writer so fields containing commas are quoted correctly. Reopen the repaired copy with a strict parser, compare the header and row count, and spot-check names, addresses, notes, quotes, and non-ASCII text. Keep a short record of which lines changed and never overwrite the source export before the destination import succeeds.
CSV Repair & Deduper runs locally in your browser, detects malformed row shapes, shows the parsed preview, and lets you review proposed changes before exporting a new file. Check your CSV free first; your file stays in the browser.
See also: our CSV quoting guide, broken-CSV guide, and backup/versioning guide.
See CSV Repair & Deduper (offline browser tool) — $19 one-time