Home › Data analysis › Clean messy data: how to do it with AI

Clean messy data: how to do it with AI

Last checked

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?).

Best pick

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

  1. Save an untouched copy of the original file.
  2. Remove or replace personal details you don't need for the cleaning (emails, phone numbers) before uploading.
  3. Tell the assistant the rules: date format you want, how to spell company names, what counts as a duplicate.
  4. Ask it to clean the file with code and to report counts: rows in, rows out, duplicates found, values changed.
  5. Open the change log or a before/after sample and check 10 to 20 rows by hand.
  6. 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 with rules
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.
Profile first
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.
Reusable script
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

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

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

Related tasks

Report an error on this page