---
title: Recipe: Clean up a messy spreadsheet · Agent Playground docs
description: Fixes spacing, capitals, dates and phone numbers, removes duplicates, and sets aside the rows a person should look at. What it does, when to use it, how to make it yours, and what a run costs.
url: https://www.quietrobot.ai/docs/playground/recipes/clean-spreadsheet
---

# Recipe: Clean up a messy spreadsheet

Fixes spacing, capitals, dates and phone numbers, removes duplicates, and sets aside the rows a person should look at. What it does, when to use it, how to make it yours, and what a run costs.

Tidies a messy contact list: trims spaces, fixes capitals, puts every date and phone number in one format, removes empty rows and duplicates, and lists every change. Rows it can't fix for sure, like an email without an @, are set aside for a person instead of guessed. No AI and no key needed.

| At a glance | |
|---|---|
| **Level** | Everyday |
| **Category** | Data |
| **Shape** | A cleanup, a check, and a person for what's unclear |
| **Plan** | Free and up |
| **Needs a Claude key** | No |
| **Limits it comes with** | 1 loop, 900 seconds, $0.05 |

```flow
{"recipe": "clean-spreadsheet", "title": "Clean up a messy spreadsheet, as it is on the canvas.", "nodes": [["load", "run", "Open the spreadsheet"], ["clean", "run", "Clean it up", "no internet"], ["check", "branch", "Is it clean?"], ["unclear", "branch", "Anything unclear?"], ["ask", "approval", "Look at the unclear rows"], ["save", "run", "Save the clean sheet"], ["held", "end", "Fix them first"]], "edges": [["load", "clean"], ["clean", "check"], ["check", "unclear", "Yes"], ["unclear", "ask", "Yes"], ["unclear", "save", "No"], ["ask", "save", "Approved"], ["ask", "held", "Denied"]]}
```

## The steps

| Step | Block | What it does |
|---|---|---|
| Open the spreadsheet | Run command | Saves a sample contact list with the usual mess: extra spaces, ALL CAPS, three date formats, four phone formats, an empty row and two duplicates. |
| Clean it up | Run command | Cleans every row, writes `contacts-clean.csv`, lists each change in `changes.md`, and puts rows it can't fix in `needs-a-person.csv`. The network is off for this step. |
| Is it clean? | Decide | Checks every date and phone number has one format and no one is listed twice. |
| Anything unclear? | Decide | **Yes** when some rows were set aside for a person. |
| Look at the unclear rows | Approval | A person looks at the unclear rows, then approves saving the clean sheet without them, or denies to fix them first. |
| Save the clean sheet | Run command | Says where the clean sheet and the list of changes are. |

## When to use it

* A sign-up list, an export from an old system, or a sheet several people typed into.
* You need the sheet clean before importing it into email, a CRM or accounting software.
* You want a list of every change, so nothing changes without a trace.

## Run it

The quick way: choose **Try it now** under the drawing. It opens the recipe in the Playground as a flow of your own, after you sign in if you aren't yet. **Simulate** opens it and shows the forecast, and **Run** opens it and asks before it starts, with what the run will likely cost. From the dashboard instead:

1. In the dashboard sidebar, open **Agent Playground → Recipes** and find **Clean up a messy spreadsheet**. Choose **Everyday** to filter the list. In the builder, **Recipes** in the toolbar lists them too.
2. Choose **Use this recipe**. It becomes a flow of your own, so changing it never changes the recipe.
3. Choose **Simulate** to see the forecast, then **Run**.
4. When the run waits for a person, approve or deny it from the banner, from **Approvals**, or from the approval email.

**What you'll see:** The run stops at **Look at the unclear rows**: two rows need a person (an email written as words, and a phone number without its area code). Approve from the banner or **Approvals**, then open **Save the clean sheet**. Six clean rows are left out of eleven.

## Make it yours

1. Replace `sheet/contacts.csv` in **Open the spreadsheet** with your own sheet (export it as CSV), or download it in that step.
2. If your columns have other names, change them at the top of `clean.py`.
3. Change the date or phone format in `clean.py` to the one your country uses.

## What a run costs

These are the builder's own forecast for the recipe as it comes, with its limits, rounded. **Simulate** shows the same numbers for your version, and they change as you change the flow.

| | Typical | 1 in 10 runs | At most |
|---|---|---|---|
| **Sandbox time** | $0.001 | $0.002 | $0.01 |
| **How long it takes** | about 2 minutes | about 3 minutes | 900 seconds |

A typical run uses $0.0013 of sandbox time, so about 800 runs cost $1, and every plan includes $5 of usage a month. The time includes a person taking a minute or two to answer the approval. The clock, and the sandbox, keep running while the run waits. **At most** is the most a run could cost with these limits: it stops at $0.05 or 900 seconds, whichever comes first.

## Related

* [Analyze my spreadsheet](https://www.quietrobot.ai/docs/playground/recipes/spreadsheet-analysis)
* [Tutorial 2: Ask a person first](https://www.quietrobot.ai/docs/playground/tutorials/approvals-and-limits)
* [All recipes](https://www.quietrobot.ai/docs/playground/recipes)
