animasai.co

Practical guides to AI for small business

Guides › Spreadsheets

Clean up a messy spreadsheet

Formats cleaned in a copy using rules you've agreed. Possible duplicates and uncertain values stay for your review. With a list of every change.

By Tyler Mayberry · Published · Updated

At a glance
You getA cleaned copy, a list of every change, and a list of what it wasn't sure about
Stays with youYour original file, deleting anything, and approval of every merge rule
You needThe spreadsheet (or a regular export), an agent, a computer
Rough costYour AI plan; usually little more, because the cleaning runs as code
Skip it ifIt's a one-off: upload it to ChatGPT or Claude instead

1What it looks like handed off

A customer list with the same person three times. Product names spelled four ways. Dates as "3/10", "10 March" and "2026-03-10" in one column. Handed off, you get a clean copy and two short lists: what it changed, and what it left for you because it wasn't sure. Your original file isn't touched.

It's most useful when the mess comes back: a weekly export from your till, booking system or website forms that needs the same fixing every time.

Example change list. The names are made up.
ChangeRows
Three possible duplicates: "J. Patel", "Jay Patel" and "jay patel" (same email address).3 keptReview required
Phone numbers written as (918) 555-0142 and 918.555.0142 put in one format.212Done
Unambiguous dates normalized using the agreed rule; ambiguous dates retained for review.87Checked
"Maria Lopez" twice, with different emails and addresses.2Left for you
Rows with no name and no email.6Flagged, not deleted

Original: customers.xlsx, unchanged. Clean copy: customers-clean.xlsx.

2The job, end to end

  1. You drop the file in a folder, or the agent picks up the weekly export where it lands.
  2. It makes a copy. All the work happens on the copy.
  3. It looks at the columns and writes down what it plans to fix: formats, spellings, possible duplicates. You approve the rules; matching email alone is not merge authority.
  4. It writes a short program to make those fixes and runs it, so every row is treated the same way and the result can be checked. It doesn't retype your data.
  5. It counts rows before and after, compares the stable-ID sets and changed values, and lists every change, with uncertain values set aside for you.
  6. You check the IDs, values and exceptions against the original, approve any separate merge rule, and use the checked copy. Next week, apply the agreed rules to the new export and check again.

Try it with six made-up rows

Download the practice CSV. All names and records are fictional. Keep this file unchanged and ask your agent to work on a copy.

Give it these rules: trim spaces around names and email addresses; lowercase emails; preserve row IDs and account codes as text. Do not merge or delete any rows. Convert only dates already written as YYYY-MM-DD or with the month spelled out. Leave ambiguous dates unchanged. Return a cleaned copy, a change list with row IDs and a review list.

Example answer key for the fictional practice CSV. The names are made up.
RowExpected result
R1Trim the name to Jay Patel and lowercase the email to jay@example.com. Keep account code 0017 and date 2026-03-10.
R2Convert 10 March 2026 to 2026-03-10. Flag R1 and R2 as possible duplicates, but keep both rows: matching email alone does not authorize a merge.
R3Keep 03/04/2026 unchanged and flag it: the file does not say whether that is March 4 or April 3.
R4Keep both Maria Lopez records, R3 and R4. Their email addresses and account codes differ.
R5Flag the blank name and email; keep the row and its date.
R6Keep account code 0004 as text. A spreadsheet program may drop leading zeros if you open the CSV without setting that column to text.

Before: six rows. After: six rows. No automatic merges or deletions.

Check the original against the cleaned copy by row ID. If a row disappeared, an account code lost its zeros or the ambiguous date was guessed, reject the copy and tighten the rules. On your real export, agree a separate merge rule before allowing any rows to be combined.

Try the next export before making this a recurring job

A cleanup rule that works on one file may mishandle next week's changes. Use these two fictional exports to check that a rerun starts from the right input and preserves changes. They contain no real customer data. Download Export V1 and Export V2, or copy each block into a separate plain-text CSV file. Keep both originals. When opening a CSV in a spreadsheet, import row IDs and account codes as text; the files alone cannot enforce that setting.

Export V1:

row_id,account_code,name,email,review_date
R1,0017, Jay Patel ,JAY@example.com,2026-10-12
R2,0021,Maria Lopez,maria@example.com,10/11/2026
R3,0004,Sam Reed,sam@example.com,12 October 2026

Export V2:

row_id,account_code,name,email,review_date
R1,0017, Jay Patel ,jay.new@example.com,2026-10-19
R2,0021,Maria Lopez,maria@example.com,10/11/2026
R4,0008, Lee Park ,LEE@example.com,19 October 2026

For this exercise, the owner says V2 is the complete replacement export. That authority comes from this instruction, not the filename. R3 is absent from V2; its absence does not authorize deleting a record in another system.

Use this instruction:

Clean each export separately, keeping the source version on the output. Trim surrounding spaces in names and emails and lowercase emails. Treat row IDs and account codes as text. Convert ISO dates and dates with spelled-out months to YYYY-MM-DD. Leave ambiguous numeric dates unchanged and flag them. Never merge or delete rows, import data or change originals. For V2, clean V2 itself, not the cleaned V1. Return each cleaned CSV, a change log, a review list and a comparison by row ID. Report added, changed and absent IDs without changing any external records.

Check both outputs

CheckExpected answer
V1 countThree input and three output rows: R1, R2, R3.
V2 countThree input and three output rows: R1, R2, R4. Do not carry R3 into the replacement export.
R1 in V2Name Jay Patel; email jay.new@example.com; date 2026-10-19; account code 0017. The email and date differ from V1.
R2 in bothPreserve 10/11/2026 exactly and flag the date order for review. No convention was supplied.
R3 in V1Preserve account code 0004; normalize 12 October 2026 to 2026-10-12.
R3 comparisonAbsent from V2. Record that observation, not “customer deleted” or “account closed.”
R4 in V2Added ID; name Lee Park; email lee@example.com; date 2026-10-19; account code 0008.
OutputsSeparate labelled clean copies and logs for V1 and V2; originals unchanged.

An unchanged row count does not prove the copy is correct. Both versions have three rows, but their IDs differ. Compare the ID set and each changed value as well as the total.

Open the copy in your spreadsheet app and check again

Import the CSV with row IDs and account codes set to text. Inspect 0017, 0021, 0004 and 0008 in the relevant version. If the spreadsheet turns them into 17, 21, 4 or 8, reject that import and reopen the unchanged CSV with the correct column settings. Formatting a shortened value to look padded is not proof that the stored identifier was preserved.

Keep V2's ambiguous date in the review list. Don't infer its order from the other rows. If someone later confirms its meaning, record that decision and make a new checked version.

Repeat without duplicating work

Run the same instructions on the unchanged V2 again. The cleaned values and ID set should agree with the first V2 clean copy. Use the same rules and compare by stable IDs; you don't need identical prose in the explanation. Keep it a separate review copy rather than importing it twice.

If the source gains a new column or changes what an identifier means, stop and review the rules before the next run. A recurring job needs a clear input version and a checked output, not just a successful schedule.

3What stays with you

Your original
It's never edited. If the clean copy is wrong, you've lost nothing.
Deleting rows
It flags empty or junk rows; it doesn't remove them unless you say so.
Every merge
No rows are merged without a separate rule you approved. Matching names or emails only identify possible duplicates; keep them separate until you authorize the rule.
Anything that leaves the folder
Uploading the clean list to your email tool or CRM is a step you take. Approval settings depend on the agent, tools and configuration.

4When it gets something wrong

It merges two different people
The change list shows every merge with the rows it combined, so you can spot one that's wrong and undo it from the original.
It "fixes" something that wasn't broken
An unusual but correct spelling, a product code that looks like a date. Tell it, and add the rule to its instructions.
Rows go missing
Compare the stable-ID sets and changed values as well as before-and-after counts. Equal totals can hide a replaced row or a wrong value. If any difference is unexplained by the approved change list, don't use the copy.
The export changes shape
If your system adds or renames a column, the weekly run stops and tells you instead of guessing. On upkeep, I update the rules.

5What it costs

ItemWhat it means
Your AI planBecause the cleaning runs as code, the AI reads a sample of your rows and writes the rules, not every row. A subscription covers it; on a pay-as-you-go key, my rough estimate is cents to a few dollars per file.
The agentClaude Code and Codex are good at this kind of work and come with their subscriptions; OpenClaw and Hermes are free and open source.
A computerAny computer that can run the agent. It only needs to stay on for a weekly run.
Your timeA few minutes to read the change list and decide the uncertain rows.

Doing it yourself

  1. Install an agent such as Claude Code or Codex, and make a folder with a copy of the spreadsheet.
  2. Tell it what clean means for you: which columns, which formats, what counts as the same customer or product.
  3. Ask it to write a script that makes the agreed fixes on a copy, compares stable IDs and values as well as row totals, and writes a change list and an unsure list.
  4. Check the IDs, changed values and exceptions against the original for the first few runs. Approve a separate rule before any merge.
  5. For a regular export, keep the script and schedule it, or ask the agent to rerun it each week.

Budget an hour or two for one file (a rough guide); a weekly routine takes a little longer to get right.

6When not to bother

  • It's a one-off. Upload a file you're allowed to share to ChatGPT or Claude, describe what clean means, and download the result. Check IDs, values, exceptions and row counts against the original.
  • Only exact duplicates or stray spaces. Excel's Remove Duplicates and Google Sheets' data cleanup tools do it in seconds.
  • The mess starts at the source. If a form lets people type dates any way they like, fixing the form beats cleaning up after it every week.

If a $20 subscription does it, I'll tell you. An agent on its own computer is worth it when the same export needs the same cleaning every week, and you'd rather not think about it.

Updated : added related guides. Cost estimates and source-check dates retain their stated dates.

7Want this running on your own computer?

I'll set it up, and keep it running if you like. On a Mac mini, a Windows PC or Omarchy, with the agent you use or want: OpenClaw, Hermes, Claude Code, Codex or another. Approval settings depend on the agent, tools and configuration. Tell me about the job and I'll quote it. If a $20 subscription does it, I'll tell you. You keep the computer, the accounts and the setup.

Tell me about the work →

Tyler Mayberry, who runs Cirlet (formerly Animas)

For independent insurance agencies nationwide, Cirlet offers AI and automation help. The first 30-minute conversation is free. Paid work and ongoing support are scoped and priced before they start.