Clean a messy CSV

Fix the delimiter, byte-order mark, ragged rows and stray whitespace in an export

The tool loads here. It needs JavaScript, because the work happens on your device.

Your files and your privacy

Your spreadsheet is never uploaded. The file is read by the browser, parsed by a Web Worker on your own device and written back out by the browser’s download mechanism. The page’s Content-Security-Policy limits connect-src to this origin, and Clear data discards the table at once.

What this tool does

Repair a spreadsheet export that will not open cleanly: the delimiter is detected rather than assumed, a UTF-8 byte-order mark is removed, rows whose cell count disagrees with the header are reported by number, and the table is written back out as clean RFC 4180 CSV.

Cleaning works on the structure of the file, not on what the data means. The tool detects which character separates the fields, strips a leading UTF-8 byte-order mark, reads quoted fields containing the delimiter or a line break, and names the row number of every row whose cell count disagrees with the header. You can then trim whitespace, collapse runs of spaces, drop blank rows and remove duplicates, before writing the table back out with RFC 4180 quoting. Renaming and reordering columns is a separate job and lives on the toolkit index, linked below.

How to use it

  1. Select Choose a CSV or JSON file and pick the export you want to fix, up to 50 MB. Pasting the text in works too.
  2. Leave the delimiter on Auto-detect; the detected value is written back into the control. If the preview shows one column, set it by hand.
  3. Read the row and column summary and the warnings, each naming a row number as a text editor counts it.
  4. Apply Trim whitespace, Collapse spaces, Remove empty rows and Remove duplicate rows in whatever order suits the file, and Undo anything you did not want.
  5. Choose the export options, then select Download CSV and Clear data when you are finished.

Example use cases

Supported input and output

Accepts

Produces

What this tool will not do

Common mistakes

Technical notes

Parsing is a hand-written RFC 4180 state machine, so quoted delimiters, newlines inside quoted fields, doubled quotes as an escape and CRLF, LF or lone-CR endings are handled by construction. It runs in a Web Worker, so a large export does not freeze the page. Delimiter detection parses a ten-row sample with each candidate and scores it by column count weighted by how rectangular the result is, so a comma inside a quoted field cannot outvote a real semicolon.

Frequently asked questions

Is my spreadsheet uploaded anywhere?
No. There is no upload endpoint: the file is read, parsed in a Web Worker and written back out on your device, and the page’s Content-Security-Policy limits connect-src to this origin.
Why did my file open as a single column?
The delimiter is wrong. Detection falls back to comma when no candidate splits the sample into two or more columns. Set it by hand: semicolon for European exports, tab for a file that was really TSV.
What does the formula-injection-safe option change?
It prefixes an apostrophe to every cell starting with =, +, -, @, a tab or a carriage return, so a spreadsheet treats it as text rather than a formula. It changes your data: a cell you meant as a working formula becomes literal text. Values that parse as ordinary numbers are exempt, so -42 is untouched.