Home › Data analysis › Clean messy data: how to do it with AI
Clean messy data: how to do it with AI
From official vendor pages; selected tasks also include dated logged-out free-plan trials. Report an error.
Intermediate Risk: Medium 📊 Data analysis
An assistant that can run code can clean a messy export: trim spaces, standardise names and dates, split columns and flag duplicates. Ask it to show what it changed, and keep the original file so you can compare.
Who it’s for: Analysts, operations and admin staff, marketers cleaning contact lists, and small business owners tidying exports from shops or booking tools.
Why medium risk: Cleaning can silently merge two different people, drop rows or reformat dates the wrong way round (03/04 as March or April?).
ChatGPT has the highest score on our published rubric (94/100) of the 3 tools listed for this task. Lists spreadsheet creation and data analysis. Its free plan includes limited data analysis (verified on its pricing page).
Step by step
- Save an untouched copy of the original file.
- Remove or replace personal details you don't need for the cleaning (emails, phone numbers) before uploading.
- Tell the assistant the rules: date format you want, how to spell company names, what counts as a duplicate.
- Ask it to clean the file with code and to report counts: rows in, rows out, duplicates found, values changed.
- Open the change log or a before/after sample and check 10 to 20 rows by hand.
- Ask for the cleaning code too, so you can rerun it on next month's export.
AI prompts to clean messy data
Replace the [brackets] with your details. See all prompt examples
Clean the attached file. Rules: dates to YYYY-MM-DD (source dates are [day-first / month-first]); trim spaces; company names in Title Case; flag (don't delete) possible duplicates where [rule]. Report rows in/out and a sample of 10 changed rows.
Before changing anything, profile this file: column types, blanks per column, odd values, likely duplicates and date formats you see. Ask me how to handle each problem.
Write a [Python pandas / Excel Power Query] script that applies these cleaning rules to a file with the same columns: [rules]. Add comments so I can rerun it monthly.
Illustrative example
You paste
Before: " acme corp ", "ACME Corp.", "Acme Corporation"; dates "3/4/26", "2026-04-03".
A good answer looks like
After (with your rule "day-first dates"): all three flagged as possible duplicates of "Acme Corp"; both dates become 2026-04-03. Report: 1,204 rows in, 1,204 out, 37 possible duplicates flagged for review.
Illustrative example written for this guide, not output captured from a specific tool.
Which tool to pick, and why
- ChatGPT (incl. Work & Codex): Lists spreadsheet creation and data analysis. Its free plan includes limited data analysis (verified on its pricing page). Free plan can do this Visit official website ↗
- Claude (incl. Claude Code): Free plan verified for files and code execution, so it can build and check a sheet from a CSV. Visit official website ↗
- Google Gemini: Its Google Workspace integration fits budgets kept in Google Sheets, and its free plan is verified for files. Visit official website ↗
Reasons come from the capabilities, free-plan details and prices we've checked on official pages (separate from any dated trial above). Sources: chatgpt.com/pricing · claude.com/pricing · gemini.google/subscriptions/
Common mistakes
- Not saying whether dates are day-first or month-first.
- Letting it delete duplicates instead of flagging them.
- Not keeping the original file.
- Skipping the row counts, so dropped rows go unnoticed.
Privacy tip
Strip columns you don't need (emails, phone numbers, addresses) before uploading, and use a business plan if the file contains customer data you're responsible for.
ChatGPT (incl. Work & Codex) setting · Claude (incl. Claude Code) setting · Google Gemini setting · Sources: help.openai.com/en/articles/7730893-data-controls-in-chatgpt · privacy.claude.com/en/articles/12109829-how-do-i-change-my-model-improvement-privacy-settings · support.google.com/gemini/answer/13594961