ChatGPT for data cleaning
How to Clean a CSV or Excel File with ChatGPT
You can upload a CSV or Excel file to ChatGPT and ask it to clean the data: it writes and runs Python code to inspect the data and can give you an updated file to download. The steps below keep the original untouched, get a plan before anything changes and check the result before you rely on it. The later sections explain where a review-first cleaner such as TidyX fits instead.
By the TidyX team · Updated
Clean a spreadsheet with ChatGPT in five steps
Work in stages so you see each decision before it changes the data. OpenAI's tips for data analysis ask you to review generated code or output tables carefully and to verify critical results yourself, since ChatGPT can make mistakes.
- Remove columns you do not need to share, such as names, email addresses or account numbers, and check that your organization's rules allow the upload. OpenAI says it does not use business customer content from ChatGPT Business and Enterprise to train its models by default.
- Upload the CSV or XLSX file and ask ChatGPT to inspect it before changing anything: row and column counts, missing values, exact duplicate rows and inconsistent formats.
- Ask for a numbered cleaning plan that gives the rule, affected columns, example rows and assumptions for each step. Say which decisions need your approval, such as filling missing values, changing types, merging categories or removing rows.
- Approve, edit or drop steps, then ask it to apply only the approved steps and give you the result as a new file to download. Keep your original file unchanged.
- Ask for the code it ran and a before-and-after summary, then run the checks below on the downloaded file.
A ChatGPT prompt you can copy
Use this with a file you are comfortable sharing under your chosen service settings. The prompt asks for review before changes; you still need to check that the response and any output follow your instructions.
Help me clean this CSV or Excel file without changing the original.
First inspect it: tell me which sheet you read, the row and column counts, missing values, exact duplicate rows, and inconsistent formats. Do not modify or delete data yet.
Propose a numbered cleaning plan. For each proposed change, show the affected columns, sample rows, the exact rule, and any assumptions. Ask me before filling missing values, changing types, merging categories, or removing rows. Keep ID and code columns as text.
After I approve the plan, apply only the approved rules and create a separate cleaned file. Provide the code used and a change summary with before/after counts. If a step cannot be completed, say so instead of inventing results.Check the result, even with a careful prompt
A prompt is a request, not an enforced approval gate. If your session cannot run code or create a file, ask for reproducible code you can inspect and run in a suitable environment. Deterministic code can also be used in a chat-assisted workflow; TidyX packages a bounded rule language, confirmation gates and audit artifacts around that execution.
Check the cleaned file before you rely on it
A clear summary is not proof that the file changed the way it says. Compare the download with your original using numbers you can recompute yourself, and ask for the code behind any step that does not add up.
- Row and column counts match the approved plan
- Removed rows are listed, not just counted
- Totals in key number columns change only where a rule should change them
- Cleaned columns hold only the labels you approved
- IDs, ZIP codes and dates keep their format
- A few rows traced by ID from the original to the output
Conversation is useful; execution needs a contract
Chat interfaces are flexible: you can describe a spreadsheet, paste examples, ask for formulas, or request code. That flexibility does not by itself establish which file version was processed, which operations were allowed, or whether the result matches a reviewed plan.
TidyX uses AI only to propose rules within an allowlist. The server validates the response against the data profile, you edit controlled parameters, and the Worker independently validates the frozen plan before execution.
Privacy and review are explicit product states
Sample sharing is a visible opt-in and defaults to off. The full file is not sent to the planning model. With the option disabled, neither masked rows nor per-column sample values appear in the model payload. With it enabled, the payload adds masked per-column examples and at most five masked rows.
Nothing runs as a side effect of receiving an answer. Review supported rules, acknowledge enabled high-risk items, confirm the plan and approve the separate cleaning quote before starting the deterministic run.
- Deterministic profiling before AI suggestions
- Rule-schema validation instead of free-form execution
- Explicit high-risk acknowledgement
- Run history, hashes, and engine version
Choose based on the task boundary
Use a general assistant when you want an open-ended explanation, brainstorming, or code you will inspect and run yourself. Use a review-first cleaner when you want a bounded upload-to-report workflow and a new output produced by a known engine.
If you want the same cleanup to run on every new export, OpenAI's tips suggest ChatGPT for conversational data exploration and the OpenAI API for fully automated workflows. TidyX takes a different route: a successful run can be saved as a versioned recipe, and each reuse creates a draft plan after a compatibility check, which you review and confirm again.
The cleaner does not replace every spreadsheet or programming workflow. It supports a bounded set of cleaning operations, including reviewed missing-value and outlier treatments. Unsupported methods are rejected rather than replaced with arbitrary model-written code.
Continue exploring