Skip to content

Notebook · 2026-09-02 · updated 2026-10-10

How to clean a CSV file

A practical sequence for inspecting a CSV, previewing cleanup, and downloading a new file without changing the original.

A CSV is plain text with a delimiter between fields. It is not a spreadsheet. Cleaning it means checking the delimiter, the header, blank rows, repeated rows, and values that only look wrong because another program guessed their type. The original file should stay untouched until you decide the new file is right.

Start by looking, not by deleting

Open the file in a viewer that understands quotes. A cell can contain a comma, a quote, or a line break. Splitting the file on every comma will tear those cells apart and every later cleanup will be wrong. CleanCSV parses with Papa Parse and shows the grid before any cleanup is available.

  1. Confirm the delimiter. Comma is common in the US. Semicolon is common when a spreadsheet uses a comma as the decimal mark. Tab means you really have a TSV.
  2. Confirm whether the first row is a header. If it is data, exporting invented names such as Column 1 would add a row you did not have.
  3. Read the counts: rows, columns, blank cells, repeated rows, and empty columns.
  4. Preview one change. Apply it only if the sample rows are the ones you meant to touch.
  5. Download a new file. Keep the original until you have opened the download and checked the sensitive columns.

A reliable order of operations

Trim outer spaces before you remove duplicate rows. Otherwise "Ada" and "Ada " stay as two rows, which is correct for an exact match and surprising if you thought they were the same person. Remove empty rows and empty columns after you are sure those blanks are not placeholders you still need. Rename duplicate headers before you hand the file to a tool that addresses columns by name.

Find-and-replace and formula protection both change cell text. CleanCSV will not run them until you preview or, for formula protection, confirm the download summary.

What not to hand to Excel yet

Excel may strip leading zeros, reinterpret dates, and shorten long IDs. Check those columns in the text file or in CleanCSV first. The article Why Excel changes CSV values covers the usual cases. If accents look like question marks, fix the encoding before any other cleanup. See How to fix CSV encoding problems.

Keep the work on the machine you trust

Customer exports, research tables, and sales lists are not sample data. CleanCSV reads the file in the browser tab and does not upload it. When you are done, clear the file. That drops the grid from the tab's memory. Closing the tab does the same.

Open the cleaner