Clean a messy CSV so Excel will open it cleanly
CSV is a simple format — commas, quotes, rows — but the files people actually receive are rarely simple. Exports from banks, shops, and form tools arrive with extra spaces, mixed date formats, amounts that are still text, duplicated rows, and the occasional cell that can make Excel do something you did not ask for.
Fix the mechanical mess first
Start with the things that should never have been in the file:
- Leading and trailing spaces in every cell, and rows that are completely blank. They break sorts and make “identical” rows look different.
- Dates in several formats.
3/9/26,March 9, 2026, and2026/03/09will not sort together. Convert them toYYYY-MM-DD. If a date is ambiguous (is 3/4 April 3 or March 4?), use the convention you actually meant — in the United States that is usually month first — and scan the column once by eye. - Currency as decoration.
$1,240.00,(32.10), and32.10-should all become numbers Excel can add. Keep a consistent sign: money out negative, money in positive, or a separate debit and credit column, but not a mix of both systems in the same column. - Inconsistent name casing if you are going to mail-merge or de-duplicate people later. “JOHN SMITH” and “john smith” are easier to compare once they share a casing rule.
Remove only exact duplicate rows unless you are sure
An exact duplicate is every cell the same as another row. Those are safe to drop if you keep one copy. Near-duplicates — the same vendor and amount on the same day, with a slightly different description — might be two real charges. Do not collapse those automatically. Count how many exact rows you removed and make sure the money total moved by exactly that amount.
Watch for formula injection
Excel and other spreadsheet programs treat a cell that starts with =, +, -, or @ as a formula when they open a CSV. That is handy for a file you wrote on purpose. It is a problem when a CSV came from a form, a bank memo, or anyone else’s system. A description that begins with = can run a formula the moment you open the file.
The safe cleanup is simple: if a cell is not a plain number, and it starts with one of those characters, prefix a single quote. Excel then treats the cell as text. A value like -19.95 is a number and should stay a number. A value like -2+3+cmd is not a number and should be guarded. After you clean a file, search the text columns for those leading characters and confirm they now start with a quote.
A short before-and-after habit
Before you overwrite anything, note three figures from the messy file (or from a first pass): row count, sum of the amount column, and a couple of distinctive rows you can find later. After cleanup, those figures should still make sense. If you dropped 20 exact duplicates, the row count should fall by 20 and the total should fall only by the amount in those 20 rows. If a date failed to convert, it will still be in the old format — scan the column rather than assuming every cell changed.
TableWren’s cleanup tab runs those steps in your browser, shows a before-and-after preview, and writes a Totals Check sheet next to the clean data. The free download is capped at 100 cleaned rows; the full preview and the full totals are still shown so you can see whether the cleanup is right before you download.
What this will not fix
Cleanup will not invent a missing category, will not decide whether two similar charges are really one, and will not repair a CSV whose columns have slipped (a comma inside an unquoted description that shifts every field to the right). If the header row and the first data row do not line up, stop and fix the structure first. A tidy column of the wrong thing is worse than a messy column of the right thing.