Clean a messy spreadsheet: dates, names and duplicates fixed, every change listed
For contact lists, exports and sheets filled in by several people. Attach the file and say what should be consistent; you get the clean file and a log of what changed.
Trim names, make dates and cities consistent, remove duplicate rows, list what changedTrim names, make dates and cities consistent, remove duplicate rows, list what changed
for fmt in ['%d %b %Y', '%Y-%m-%d', '%d/%m/%Y']:
... # every date becomes YYYY-MM-DD
name = re.sub(r'\s+', ' ', name).strip().title()
dup_mask = cl.duplicated(subset=key, keep='first')
cl.to_excel(OUT_DIR + '/customers-clean.xlsx', index=False)
pd.DataFrame(changes).to_csv(OUT_DIR + '/customers-changes.csv')Output
rows read: 24 duplicates removed: 0 changes logged: 81
| Row | Column | Before | After | Why |
|---|---|---|---|---|
| 2 | signup_date | 2 Mar 2026 | 2026-03-02 | converted to YYYY-MM-DD |
| 3 | name | JOHN SMITH | John Smith | trimmed/standardised case |
| 4 | signup_date | 15/03/2026 | 2026-03-15 | converted to YYYY-MM-DD |
| 5 | city | lisbon | Lisbon | standardised city name |
A real run on made-up data. See what came out:
Try one of these
Remove duplicates
Find repeated rows, also when spacing or capitals differ.
Use thisMerge two files
Join exports on an email or ID column.
Use thisSplit a column
Full name into first and last name, or an address into parts.
Use this
What you get
Nothing changes silently
Ask for a change list and each edit is shown with its row.
Doubts are flagged
In the example, repeated emails with different details were kept and marked to check.
Your original stays
The result is a new file; the one you attached is not touched.
Questions
How big can the file be?
Up to 8 MB of attached files per run, and result files up to 2 MB each.
Is it free?
Your first analysis is free. After that, each run uses credits, which come with any paid plan or can be added from $5.
What happens to my file?
The code runs in an isolated sandbox with no internet access, and its temporary working files are removed after a short time. The files stay in your own account.