How to clean a messy CSV file, step by step

Updated 2026-11-26

Start by looking, not fixing

Open the file in a plain viewer before you change anything. Spreadsheet programs can reformat long numbers, dates and leading zeros the moment they open a CSV, which hides what the data really looked like. A viewer such as the CSV Viewer shows the raw cell text, the row count and the column count. Write those two counts down. You will compare them with the cleaned file at the end.

Step 1: Confirm the delimiter and encoding

If everything lands in one column, the file probably uses semicolons or tabs. If letters such as é or ü look broken, the file is not UTF-8. Fix these two before anything else, because every later step depends on the columns being split correctly. The CSV Delimiter Converter rewrites a file with the delimiter you need and saves it as UTF-8.

Step 2: Remove blank rows and empty columns

Blank lines at the end of an export and columns nobody filled in add noise and can break imports. Use the Empty Rows Remover and the Remove Empty Columns tool. Check the counts afterwards: you should lose only rows and columns that were truly empty.

Step 3: Fix whitespace and odd characters

Spaces around values make "Austin" and "Austin " different cities. Non-breaking spaces copied from web pages are invisible and break lookups. Run the CSV Cleaner with trim, collapse and non-breaking space fixes ticked. Leave case changes off unless you are sure, because product codes and IDs are often case sensitive.

Step 4: Remove duplicates carefully

Decide what makes two rows the same. For a contact list it is usually the email column, ignoring case. For order lines it may be order ID plus product. Use Remove Duplicate Rows with those columns and download the removed rows to check that nothing valuable went with them.

Step 5: Check the result

Compare the final row and column counts with your notes. Open the file in the viewer again and scan a handful of rows, especially the first, the last and any you know were problematic. Keep the original file. A cleaned copy is a new file, not a replacement.

A short checklist

Tools mentioned