Clean duplicates and bad dates in a sheet with ChatGPT
The struggle: Messy exports with duplicates and bad dates eat your Monday morning before the real work starts.
What you end up with: A cleaned copy of your sheet plus a change log listing every row removed or edited, so you can undo anything.
Keep the original, ask ChatGPT to find problems first, approve the rules, then clean a copy with code. The change log lets you check what happened to every row.
Tools: ChatGPT. Level: Free to start. Time: 30 min.
Use it if
- You get exports with duplicate rows
- Dates arrive in mixed formats
- You clean the same file every week
Skip it if
- The file has only a few rows you could fix by hand
- You cannot keep an untouched original
What you need first
- A ChatGPT account with file uploads and data analysis (limits vary by plan and are not published)
- An export that is not your only copy
The method
Save the original and pick a sample (ChatGPT: Chat)
Save the original file and never edit it. Make a copy. Pick a sample of about 100 rows that includes known problem rows. Upload the sample first, not the whole file.
You get: An untouched original and a small test file.
Tip: A sample with known bad rows tells you quickly if the rules work.
Find problems, change nothing (ChatGPT: Data analysis)
Paste the prompt and read the list of problems. Decide the rule for each: which duplicate to keep, and which date format is right.
Prompt to copy:
Do not change anything. Find: duplicate rows (exact, and near duplicates by [key columns]), dates in mixed formats or impossible dates, trailing spaces, mixed upper and lower case in [column], and empty rows. For each problem give the count and three example rows. Ask me which rule to apply for each. If you are unsure whether two rows are duplicates, list them as unsure.
You get: A list of problems and your decision per rule.
Tip: Ask it to say how many rows each rule would touch.
Clean the sample and check the log (ChatGPT: Data analysis)
Reply with your rules and ask for a cleaned sample plus a change log: row number, what changed, old value, new value. Compare ten rows with the original.
Prompt to copy:
Apply these rules: [your rules]. Date format is [DD/MM/YYYY or MM/DD/YYYY]. Return the cleaned file and a change log with row number, action, old value and new value. Never delete a row without logging it. If a rule could change a legitimate row, keep the row and flag it.
You get: A cleaned sample and a log you can read.
Tip: If a date like 03/04 is unclear, state the format yourself.
Run the full file and reconcile counts (ChatGPT: Data analysis)
Upload the full file and repeat with the same rules. Check that rows in minus rows removed equals rows out, and compare one or two totals with the original. Download the cleaned CSV.
You get: A cleaned full file with a log and matching counts.
Tip: Keep the rules as a saved prompt for next week.
Where this goes wrong
- Near duplicate rules can merge two real customers or payments. Review every flagged near duplicate.
- Date formats like 03/04 can be read two ways. Say which one you mean.
- Never overwrite the original file.
- Have a qualified person check this before you sign, file or send it.
Sources
More like this
- Sort a year of bank lines into categories
- A polite late payment email ladder
- Your spreadsheets, explained and charted
Updated . Written with AI help and checked by an independent review step, as described in our editorial standards.