Guides/

How to Fix a Broken CSV File

A “broken” CSV usually still opens. It just loads with the wrong number of columns, a blank heading, or a quote that swallowed half the file.

Fix the text. Do not paper over it in a spreadsheet.

What CSVUtility actually checks

Edit → Check Data Quality… (also in the Command Palette) scans the open file in the background. You can cancel a long check. When it finishes you get an alert:

  • Data Quality Looks Good, or
  • Data Quality Issues Found

The summary is built from a structural scan:

  • Blank headers, named with column letters (A, B, C)
  • Duplicate headers, matched case-insensitively and ignoring diacritics (email vs Émail counts)
  • Rows with an unexpected column count, compared with the header row’s field count, with the first mismatch called out as row N has X; expected Y
  • Rows with unbalanced quotes

It reports how many data rows it checked (everything under the header). Navigable samples cap at 1,000 issues of each sampled kind so the jump list stays finite on a huge file.

If there is a first problem, the alert offers Go to First Issue. After that, Edit → Next Data Quality Issue (⌘⌥]) and Previous Data Quality Issue (⌘⌥[) walk the stored cells.

Find problems before you open the Mac app

For files under 15 MB, the CSV validator flags the same families of issues in the browser. Nothing is uploaded. Use Load broken sample on that page to see the report shape.

Fixes that match the diagnostics

  1. Unbalanced quotes. Jump to the flagged data row. Find the field that should be quoted (often an address or comment with a comma) and close the quote. Save.
  2. Unexpected column count. Either pad a trailing empty field, or quote an inner comma that created an extra column.
  3. Blank headers. Click the heading (row 1 in the grid) and type a name, or use Edit → Column → Rename….
  4. Duplicate headers. Rename one to email_2 or similar. Filters, JSON objects, and WHERE clauses all get worse with two email keys.
  5. Banner rows. Keep one header line. Move “Confidential” commentary out of the CSV.

Edit → Clean Selected Cells and Transform Selected Cells… help after the structure is valid (trim, case, fill blanks). They will not repair an unclosed quote that merged two rows in the parser.

Do not “fix” it only in Excel

Excel may open the mess, guess types, and Save As a new CSV that is technically valid and factually wrong. Leading zeros disappear. Dates shift.

If you already went through Excel, compare that copy to the original with the browser CSV diff (small files) or keep the original in CSVUtility and inspect it with Data Quality first.

Large files

The quality scan walks mapped bytes and counts fields without decoding every cell, so working memory stays flat. Download CSVUtility for files that would lock a browser tab.

Need this on a large file?

CSVUtility opens huge CSVs on a Mac. Search, filter, and compare changes without waiting on a spinner.

Download for MacOS