From Messy Exports to Analysis-Ready Tables: A Spreadsheet Data Cleaning System with AI Chat
Dates clash, categories sprawl, duplicates everywhere. Clean messy spreadsheet exports with an AI chat using this practical seven-step workflow.

The monthly sales file has just landed in your inbox. You open it and your enthusiasm evaporates: dates mixed between "12/05/2024" and "May 12, 2024", customer names capitalized at random, a city column holding "Jakarta", "jakarta ", and "JKT" at once, and two title rows from the source system sitting on top. The pivot table refuses to run, and the report is due today.
This happens in almost every office. The good news: data cleaning that normally eats hours can be dramatically shortened with an AI chat like ChatGPT, Claude, or Gemini. You make the decisions; the AI writes formulas, designs cleaning rules, and builds the checks. All you need: Google Sheets or Excel and one chat window. Here is the workflow, in seven practical steps.
1. Audit the Damage First
Don't touch anything yet. Copy the column headers plus 10–20 sample rows into the AI chat and ask for a diagnosis. If the data is sensitive, mask what doesn't need to be shared — the AI needs only the pattern, not the contents.
Here are the headers and 15 sample rows from my sales export:
[PASTE DATA]
Diagnose all data quality problems, ordered by the risk they
pose to analysis. For each: the column, an example, and how to
fix it in Google Sheets. Plan only, no formulas yet.
You get a damage checklist: merged cells, dates stored as text, currency-prefixed numbers, inconsistent categories. Plan first, execute later — the wrong order means doing work twice.
2. Fix the Structure: One Row per Record, One Column per Value
Clean data follows the rule formalized in the "Tidy Data" research: every row is one record, every column one variable, and no merged cells. Typical violations: "Budi - Finance" crammed into one cell, or month names used as column headers.
Ask the AI for the conversion steps:
Column C contains "Name - Department" in a single cell across
3,000 rows. Give me Google Sheets formulas to split it into two
columns: "Name" and "Department". Prefer formulas or built-in
features, not manual editing.
The answer is usually SPLIT or TEXTBEFORE/TEXTAFTER in Sheets, or Text to Columns in Excel, plus an unmerge-then-fill-down pass for merged cells. Fix the structure first — every later step gets easier once the table's shape is right.
3. Standardize Dates, Numbers, and Text
These three data types break formulas and pivots most often. Dates appear as "12/05/2024" (May or December?), "May 12, 2024", or plain text. Numbers sit around as text like "$1,500,000". Text has its own trouble: invisible trailing spaces and random capitalization.
One forgotten detail: mention your spreadsheet's locale. It changes the decimal separator and even the argument separator inside formulas. Example prompt:
The Date column mixes "12/05/2024", "May 12, 2024", and plain
text. The Price column contains text like "$1,500,000".
Give me formulas to convert both into real dates and numbers,
and explain how each formula works so I learn the pattern.
For text, TRIM (extra spaces), CLEAN (invisible characters), and PROPER (capitalization) handle most cases. Always work in new helper columns instead of overwriting the original data.
4. Tame Random Categories with a Mapping Table
This is the biggest share of the work: the same city written a dozen ways — "Jakarta", "jakarta ", "JAKARTA", "JKT", "DKI Jakarta". Editing thousands of rows manually is impossible, and find-and-replace risks changing the wrong words.
The technique: extract unique values with UNIQUE first, then have the AI group them.
Here are the 87 unique values from my City column (from UNIQUE):
[PASTE LIST]
Group values referring to the same place, then build a mapping
table: "Original" and "Standard" (official city names). Flag
any you are unsure about so I can decide.
Paste the mapping table into a separate sheet, then add a column with XLOOKUP (or VLOOKUP) that pulls the standard name for each row. Every standardization decision is now documented in one small table you can review in minutes — not 3,000 rows.
5. Duplicates and Empty Cells: Rules First
Remove Duplicates looks convenient but is dangerous without rules. Two identical rows are safe to merge — but what if their timestamps differ? In transactional data, duplicates are often real repeat sales, not typos. Empty cells demand a decision too: fill with zero, flag, or leave?
My sales data has 3,000 rows. Give me rules plus formulas to:
(1) add a helper column marking duplicate rows "DUPLICATE of
row X" for review before deleting, (2) flag empty cells in the
Price column with "CHECK" for easy filtering. Delete nothing
automatically.
The "flag first, delete later" pattern protects you from data loss that cannot be undone.
6. Validate: Count First, Trust Later
Silent cleaning failures are the most expensive: rows lost by accident, numbers changed by a wrong format, categories mapped wrong. Before the data gets used, run three quick checks.
First, compare row counts before and after — they must match, unless you intentionally removed duplicates (write down how many). Second, sum the key numeric column before and after; the total may change only by removed duplicates, otherwise it must be identical. Third, spot-check five random rows against the original.
Give me Google Sheets formulas for a "validation sheet" in
DataBersih: row count, Price total, and per-category totals,
side by side with comparison figures I paste from the original
data, plus an OK/MISMATCH status cell for each.
Five minutes of validation is far cheaper than a wrong report reaching the board.
7. Keep the Cleaning Recipe
If a similar export arrives every month, don't start from zero. Save the whole cleaning conversation as a "recipe": problem list, formula per problem, mapping table, validation steps. Next month, paste 15 sample rows of the new data plus the recipe, and ask the AI to adjust what changed.
Want to go further? Turn the recipe into automation:
Convert this cleaning recipe into a Google Apps Script for the
sheet "NewExport": normalize dates, apply the city mapping,
flag duplicates, and build a "Validation" sheet. Comment each
section so I can understand how it works.
Test on a copy first, never the original. Once proven, cleaning the monthly export goes from two hours to five minutes.
Messy data is not a sign of bad file management — it is the natural shape of data arriving from many systems. The only difference is whether you clean it by hand or with an assistant that writes formulas in seconds. Next time a messy export lands, don't start sweeping: paste a sample into your AI chat, ask for a diagnosis, execute the plan step by step, and finish with validation. The most annoying column in your file is the best place to start.
References
- Google Sheets function list — Google Docs Editors Help — official reference for SPLIT, TRIM, UNIQUE, XLOOKUP.
- Excel Help & Learning — Microsoft Support — official guides to Text to Columns and text functions.
- Apps Script documentation — Google Developers — official docs for Google Sheets automation.
- Tidy Data — Hadley Wickham, Journal of Statistical Software — the research behind the tidy-data rule.



