Nearly every CSV file you receive from another system needs some cleaning before it is useful. A CRM export has trailing spaces on half the email addresses. A merged mailing list contains the same customer three times. A report from finance arrives with blank lines between sections and a column called Unnamed: 7. None of these problems is hard to fix on its own, but fixing them in the wrong order — or in a way that quietly changes other values — creates new problems.
This checklist sets out an order that works, explains why each step matters, and points out the traps. You can follow it in a spreadsheet, in code, or with a dedicated tool such as the CSV Cleaner.
Step 1: Keep the original file
Before changing anything, make sure the original export is saved somewhere you will not overwrite it. Cleaning removes and rewrites data; if a step goes wrong — the wrong columns compared for duplicates, say — you need a way back. Name the cleaned file differently (customers-cleaned.csv) and keep both until the cleaned version has been checked and used.
This also gives you an audit trail. When someone asks why a record is missing from the mailing list, you can compare the two files and show which rule removed it.
Step 2: Check the encoding and delimiter
Two invisible properties decide whether the file is read correctly at all.
Encoding. If accented names, currency symbols or non-Latin text look garbled (José instead of José), the file was saved in one encoding and read in another. Most modern systems use UTF-8. Excel’s older “CSV” option often writes Windows-1252 instead, while “CSV UTF-8” adds a byte order mark at the start. Work out which you have before you do anything else, because every later step compares text.
Delimiter. Despite the name, many “CSV” files use semicolons, especially from European versions of Excel, where the comma is the decimal separator. Others use tabs or pipes. If your preview shows everything crammed into one column, or numbers like 3,50 split across two, the delimiter is wrong.
Step 3: Fix the header row
Columns are referred to by name in almost every later step and in whatever system receives the file. Check that:
- every column has a name (exports often produce a blank header for an index column);
- no two columns share a name (two
Emailcolumns will collide in most tools); - names are free of stray spaces —
"Email "and"Email"are different columns to a computer; - names are meaningful to the people who will use the file. Rename
cust_eml_addr_1toemailif that helps.
This is also the moment to remove columns you do not need. Fewer columns mean fewer things to check, smaller files and less personal data being passed around — a sensible privacy habit as well as a practical one.
Step 4: Trim leading and trailing whitespace
Spaces at the start and end of values are among the most common and least visible problems. They come from copy-and-paste, form fields, and fixed-width exports. They break things in subtle ways: " ana@example.com" will not match "ana@example.com" in a lookup, a join or a duplicate check, and some email platforms reject it outright.
Trim before you de-duplicate. If you remove duplicates first, " Ana Silva" and "Ana Silva" are treated as two different people and both survive.
Be careful with trimming in two situations: when spaces are meaningful (fixed-width codes, some passwords or identifiers), and when you only want to trim certain columns. A good tool shows you which cells changed so you can check.
Step 5: Remove completely empty rows
Blank lines between report sections, trailing empty lines at the end of a file, and rows that contain only delimiters (,,,,) are noise. They inflate row counts, create empty records on import and can make tools think the data has ended.
Define “empty” strictly: a row is empty only if every field is empty. A row with an email address but no name is not empty — it is incomplete, and deleting it silently would lose a real record. If you have trimmed whitespace first, a row containing only spaces also counts as empty, which is usually what you want.
Step 6: Remove duplicate rows
Duplicates appear when lists are merged, when an export is run twice, or when a form is submitted more than once. Before removing them, decide what “duplicate” means for this file:
- Exact duplicates across all columns. Two rows are the same only if every value matches. This is the safest rule and never merges genuinely different records.
- Duplicates on a key column. For a mailing list, two rows with the same email address are probably the same person even if the names differ (
Ana SilvavsA. Silva). Comparing only the email column catches these.
Also decide which copy to keep. Keeping the first occurrence and preserving the original order is the most predictable choice, and it means that sorting the file beforehand (for example, newest record first) lets you control which version survives.
Keep a list of what was removed. If a duplicate check on a key column removes a row you did not expect, you will want to see it.
Step 7: Standardise values
Now that rows are clean, look at consistency within columns:
- Case:
UK,ukandUkwill be counted as three countries. - Names for the same thing:
United Kingdom,UK,Great Britain. - Dates:
03/04/2025means 3 April in the UK and 4 March in the US. Converting to ISO 8601 (2025-04-03) removes the ambiguity. - Units and currencies: prices in cents and prices in dollars in the same column; weights in kg and lb.
- Placeholders:
N/A,none,-,0and empty cells that all mean “unknown”.
This step needs judgement and knowledge of the data, so it is the hardest to automate safely. Make changes deliberately, one rule at a time, and check a sample after each. Avoid tools that “fix” types automatically — converting codes to numbers or dates is how leading zeros and product codes get lost (see our guide on converting CSV without losing data).
Step 8: Validate and export
Before you hand the file on, check it:
- Row count. Compare with the original: original rows − empty rows removed − duplicates removed should equal the cleaned count. If it doesn’t, something unexpected happened.
- Column count. Every row should have the same number of fields as the header. Rows with extra or missing fields usually point to a delimiter or quoting problem.
- Spot checks. Look at the first rows, the last rows and a few records you know well.
Then export with settings that suit the recipient:
- Delimiter: comma for most systems, semicolon for European Excel, tab if values contain lots of commas (see CSV vs TSV).
- Encoding: UTF-8. Add a byte order mark if the file will be opened in Excel, so non-English characters display correctly.
- Line endings: CRLF for Windows tools that insist on it; LF otherwise.
- Spreadsheet safety: if the file will be opened in a spreadsheet and contains values typed by the public, consider neutralising formula-like cells — see CSV injection explained.
If the cleaned file is too large for the destination — an import limit, an email attachment, or Excel’s 1,048,576-row ceiling — split it into parts with the header repeated in each, using a CSV splitter.
Doing it with the RapidConvertor CSV Cleaner
The CSV Cleaner covers steps 2 to 6 and step 8 in one screen, in the order described here. You choose the operations — trim, remove empty rows, remove duplicates by all columns or selected columns — and rename, reorder or drop columns. It shows the data before and after, highlights every trimmed cell, lists each removed row with its original row number and the row it duplicated, and never converts types. Clearing the operations returns you to the original data, and the download is a new file, so your original is never overwritten. Like all our tools, it runs in your browser; the file is not uploaded.
A quick reference
| Problem | Symptom | Step |
|---|---|---|
| Wrong encoding | José, € |
2 |
| Wrong delimiter | One wide column, or split numbers | 2 |
| Blank / duplicate headers | Unnamed: 7, two Email columns |
3 |
| Stray spaces | Lookups and duplicate checks fail | 4 |
| Blank lines | Extra empty records on import | 5 |
| Repeated records | Customers emailed twice | 6 |
| Inconsistent values | UK / uk, mixed date formats |
7 |
| Too many rows | Import or spreadsheet limit reached | 8 |
Summary
Clean in a fixed order: protect the original, make sure the file is read correctly, fix the header, trim, remove empty rows, remove duplicates, standardise, then validate and export. Trimming before de-duplicating, deciding what a duplicate means before removing any, and checking row counts at the end will prevent most of the surprises that make data cleaning frustrating.