How to Clean Messy Data in Google Sheets With AI
Clean messy data in Google Sheets with AI: free Cleanup suggestions and formulas first, then Gemini and the AI function. Steps, limits and plan needs.
Quick answer: Start with the free Cleanup suggestions sidebar (Data > Data cleanup > Cleanup suggestions), then use Gemini's Ask Gemini panel or the =AI() function for what is left. Free? The sidebar and formulas are free. The Gemini tools need an eligible Google Workspace or Google AI plan. Time: about 10 minutes for a typical sheet.
Google's own help page says Cleanup suggestions help you spot extra spaces, duplicates, missing number formatting, anomalies and inconsistent data. For the harder jobs, such as sorting free text into categories, Google's Gemini features can do the work from a plain-English instruction. All details below are as of 14 October 2026.
What do you need before you start?
You need a Google Sheet open on a computer. Google's steps for the features below are written for desktop use.
- For Cleanup suggestions and formulas: any Google account.
- For Ask Gemini, the AI function and Enhanced Smart Fill: Google says each requires an eligible Google Workspace or Google AI plan. Google's plan comparison lists the AI function and Enhanced Smart Fill (plus a "Generate insights and analyze data" feature) under Business Standard, Business Plus, Enterprise Standard, Enterprise Plus, Google AI Pro and Google AI Ultra. It does not list them for Business Starter, Enterprise Starter, Frontline or Google AI Plus.
- A backup: click File > Make a copy before you start. The AI function cannot be undone or redone.
- An Excel file? Google says Gemini works best on native Sheets files. Choose File > Save as Google Sheets first.
How do you clean messy data in Google Sheets with AI? (Method 1: free Cleanup suggestions)
Open the Data menu and use the built-in cleanup sidebar. It costs nothing and does not need a Gemini plan.
- Open your spreadsheet in Google Sheets.
- At the top, click Data > Data cleanup > Cleanup suggestions.
- Read the suggestions in the sidebar. Hover over a suggestion to highlight the related cells in the sheet.
- Click the icon on a column to see that column's suggestions.
- Apply the ones you agree with. Skip the rest.
Google's page says anomalies or errors show in red while other suggestions show in green. After you import data, a Data cleanup notification can also appear at the bottom right. Click See all to open it.
Google's page does not name the buttons that apply a suggestion. If the buttons in your sidebar look different from what you expect, trust what the sidebar shows. Verify this step: the menu may differ.
Method 2: Which formulas fix the most common mess?
A handful of text formulas handle most of what Cleanup suggestions misses. They are free and they never guess. Put each formula in a spare column next to the messy one, then copy the results back with Edit > Paste special > Values only.
| Problem | Formula | What Google says it does |
|---|---|---|
| Extra spaces | =TRIM(A2) | Removes leading, trailing and repeated spaces |
| Hidden characters | =CLEAN(A2) | Removes non-printable ASCII characters |
| Inconsistent capitals | =PROPER(A2) | Capitalizes each word |
| Two values in one cell | =SPLIT(A2, ",") | Puts each fragment into a separate cell in the row |
| Unwanted characters | =REGEXREPLACE(A2, "[^0-9]", "") | Replaces text matching a regular expression |
| Duplicate rows | =UNIQUE(A2:C100) | Returns unique rows, discarding duplicates |
Three limits matter:
- TRIM skips non-breaking spaces. Google's TRIM page says whitespace or non-breaking space will not be trimmed. Text pasted from web pages often has them. Try
=TRIM(SUBSTITUTE(A2, CHAR(160), " ")), which swaps each non-breaking space (character 160) for a normal one first. - CLEAN is narrow. It only removes non-printable ASCII characters, and Sheets does not show them in the interface, so you often see no change.
- PROPER lowercases the rest of each word. Google's example:
PROPER("mcLeod")gives "Mcleod". Check surnames and brand names afterwards.
For duplicates, Google notes that apparent duplicates can survive UNIQUE because of hidden differences such as trailing spaces. Run TRIM first.
Method 3: How do you clean data with Ask Gemini?
Click Ask Gemini at the top right of Sheets and type what you want in plain English. Google's help page lists find and replace, deleting rows or columns, setting number formats, sorting, filtering and conditional formatting (including for duplicate entries) among the actions.
- Open your spreadsheet in Google Sheets.
- At the top right, click Ask Gemini.
- In the side panel, select a suggested prompt or write your own.
- Review the action preview card that appears.
- Click Apply if the preview is right.
- If it is wrong, click Undo. Google says Undo is available until you make further changes.
Prompts that match Google's own examples:
Clean up this tracker: make the status and priority columns into dropdownsDelete rows where status is archivedHow can I remove duplicates?
Be specific. Name the column ("in column C") and the change ("replace 'N/A' with a blank"). Google says Gemini features may suggest inaccurate or inappropriate information, so check the preview before you click Apply.
Method 4: How do you categorize or reformat text with the AI function?
Use =AI() when each row needs a judgment call, such as sorting comments into groups. The syntax on Google's help page is AI("prompt", [optional range]). You can also type =Gemini().
- Open your spreadsheet in Google Sheets.
- In an empty cell, enter
=AI(). You can also use Insert > Function > AI. - Write the formula, for example:
=AI("Categorize the customer inquiry as a compliment, exchange request, or return request.", C2) - Select the cell or cells that contain an AI function.
- Click Generate and Insert.
- To redo the output, click Refresh and Insert.
- Copy the formula down the column, then generate again.
The example prompt in step 3 is taken from Google's page. For tidying text, you can write prompts in the same style, such as Rewrite this address in the format: street, city, postcode with the address cell as the range.
Know the limits from Google's page:
- Only the first 350 selected cells with AI functions are generated at one time. Wait, then select more.
- There are short-term and long-term generation limits. Google says to wait 24 hours if you hit the long-term one. It does not publish a daily number.
- Responses are limited to text.
- The function does not see your whole spreadsheet or your Drive files. Put the data it needs in the range.
- You cannot undo or redo it, and embedded use such as
=IF(AI(...))is not supported. - If a column holds non-contiguous cells, join them with
&. Changes to those cells do not trigger a refresh, so refresh by hand.
If you prefer a different assistant inside Sheets, see our guides on using ChatGPT inside Google Sheets and using Claude in Docs, Sheets and Slides.
What about Enhanced Smart Fill?
Enhanced Smart Fill predicts missing values from patterns in your sheet, with no prompt. Google says it detects the relationship between incomplete column pairs and offers to fill the rest. Its listed uses include converting address data to a consistent format and extracting phone numbers from text fields.
When a suggestion appears, click the suggestion bubble to accept it. Click the cancel icon on the expanded suggestion to reject it.
It has tight conditions:
- English values only.
- Text columns only, not numeric or date columns.
- A table needs at least 3 example rows with 2 distinct column values.
Which method should you choose?
Pick the cheapest tool that fixes the problem. Formulas are predictable. AI is flexible but can be wrong.
| Method | Cost | Difficulty | Limits | Best for |
|---|---|---|---|---|
| Cleanup suggestions | Free | Easy | Suggests only; button labels vary | First pass on spaces, duplicates, formats |
| Formulas (TRIM, SPLIT, UNIQUE) | Free | Medium | Exact rules only | Repeatable, auditable fixes |
| Ask Gemini | Eligible Workspace or Google AI plan | Easy | May be inaccurate; check preview | One-off edits across a sheet |
| AI function | Eligible Workspace or Google AI plan | Medium | 350 cells per run; text only; no undo | Categorizing or rewriting free text |
| Enhanced Smart Fill | Eligible Workspace or Google AI plan | Easy | English, text columns, 3+ examples | Pattern-based fills |
What's free and what costs money?
As of 14 October 2026, the Cleanup suggestions sidebar and every formula in this guide are free. The Gemini features need a paid plan. Google's plan comparison lists the AI function and Enhanced Smart Fill for Business Standard and above, and for Google AI Pro and Ultra on personal accounts. For Google AI plans, Google says usage limits apply. Prices vary by country, so check Google's pricing page for your region.
What can go wrong, and how do you fix it?
- The AI function is not available. Google says this can mean you lack an eligible plan, your admin blocked it, or your language setting does not support it. Ask your admin first.
- Duplicates are still there after UNIQUE. Hidden trailing spaces or mixed number formatting. Run TRIM, and format all numbers the same way.
- Names look wrong after PROPER. It lowercases letters inside words. Fix exceptions by hand.
- Smart Fill does not appear. Check that the column is text, in English, with at least 3 example rows.
- Only some AI cells filled. You hit the 350-cell cap. Select the next batch.
- Gemini changed more than you wanted. Click Undo straight away, before making other edits.
Is this allowed, and is my data safe?
Yes, these are standard Google features, but sensitive data deserves care. Google says it does not use your Workspace data to train or improve the underlying generative AI models that power Gemini outside Workspace without permission. These are Google's statements about its own product. Workspace admins can control access to Gemini features, so company sheets may follow your employer's rules.
Do not paste customers' personal data into a prompt unless your organization allows it. Google also warns that content added by Gemini may be visible to users outside your domain when a file is shared externally.
What's still unclear?
- Exact button names in Cleanup suggestions. Google's page names the menu path but not the apply buttons.
- AI function quotas. Google describes short-term and long-term limits but publishes no daily figure.
- Accuracy. Google publishes no error rate for categorizing or reformatting. Spot-check a sample of rows before trusting a whole column.
- Weakest point of the argument. For fixed rules, formulas beat AI because they give the same answer every time. The AI function can return different text on a refresh.
To go further, see how to pull API data into Google Sheets and how to send emails from Google Sheets automatically once your data is clean.
Last checked: 14 October 2026.
Frequently asked questions
Can I clean data in Google Sheets with AI for free?
Partly. The Cleanup suggestions sidebar (Data > Data cleanup > Cleanup suggestions) and formulas like TRIM, SPLIT and UNIQUE need no AI plan. Gemini features such as Ask Gemini, the AI function and Enhanced Smart Fill require an eligible Google Workspace or Google AI plan, according to Google's help pages as of 14 October 2026.
What is the difference between Ask Gemini and the AI function?
Ask Gemini is a side panel where you type an instruction and click Apply on a preview of the change. The AI function is a formula, =AI("prompt", range), that writes a result into each cell. Use Ask Gemini for one-off edits to a whole sheet and the AI function for row-by-row text jobs like categorizing.
Why does TRIM not remove all the extra spaces?
Google's documentation says TRIM does not remove whitespace or non-breaking spaces. Data copied from web pages often contains non-breaking spaces. Replace them first with SUBSTITUTE(A2,CHAR(160)," ") and then wrap the result in TRIM.
Can I undo what the AI function wrote?
Google says you can't undo or redo an AI function. You can regenerate the output instead. For safety, work on a copy of the sheet or a spare column, and keep your original column until you have checked the results.
Does Google use my spreadsheet data to train Gemini?
Google says it does not use Workspace data to train or improve the underlying generative AI models outside Workspace without permission. Check your admin's settings if the sheet holds sensitive data.
Does Gemini work on Excel files opened in Sheets?
Google says Gemini works best with native Google Sheets files. For an Excel (.xlsx) file, choose File > Save as Google Sheets first, then use Gemini on the converted copy.
Sources
- Use Sheets Smart Cleanup to prepare your data for analysis, Google Docs Editors Help (2026-10-14)
- Collaborate with Gemini in Google Sheets, Google Docs Editors Help (2026-10-14)
- Use the AI function in Google Sheets, Google Docs Editors Help (2026-10-14)
- Use enhanced Smart Fill with Gemini in Google Sheets, Google Docs Editors Help (2026-10-14)
- Get started with Google Workspace with Gemini, Google Drive Help (2026-10-14)
- TRIM function, Google Docs Editors Help (2026-10-14)
- CLEAN function, Google Docs Editors Help (2026-10-14)
- PROPER function, Google Docs Editors Help (2026-10-14)
- REGEXREPLACE function, Google Docs Editors Help (2026-10-14)
- SPLIT function, Google Docs Editors Help (2026-10-14)
- UNIQUE function, Google Docs Editors Help (2026-10-14)
- Gemini data protection in Google Workspace, Google Docs Editors Help (2026-10-14)