Back to cookbook

AI Prompt to Clean and Standardize a Messy Spreadsheet Dataset

15 views Published

Make this prompt yours

Share

This is a data cleaning prompt for turning a messy spreadsheet or CSV export into a consistent, analysis-ready dataset — built for analysts, marketers, and small business owners who receive data from multiple sources (form exports, CRM downloads, manual entry) with inconsistent formatting. It's aimed at problems like mismatched date formats, inconsistent capitalization, duplicate rows, and stray whitespace that break downstream analysis or reporting.

The prompt asks the model to work through the dataset systematically: identify formatting inconsistencies column by column, propose a standard format for each, flag likely duplicates or outliers for human review rather than silently deleting them, and return both the cleaned data and a plain-language summary of every change made. This keeps a human in the loop for judgment calls (like whether two similarly-named rows are actually duplicates) while automating the repetitive formatting work.

ChatGPT, Claude, and Gemini can all read and reformat tabular data pasted as text, but none of them execute your original spreadsheet formulas or verify cleaned output against your source system, so any cleaned dataset should be spot-checked against the original before it's used for reporting or decisions.

Prompt template

Make this prompt yours

prompt-template
278 tokens
ROLE: You are a data cleaning assistant helping standardize a spreadsheet dataset for analysis. CONTEXT: Below is a sample of the dataset. Columns are: [LIST OF COLUMN NAMES] [PASTE SAMPLE DATA HERE, INCLUDING KNOWN PROBLEM ROWS] TASK: 1. Review each column and identify formatting inconsistencies (e.g. date formats, capitalization, whitespace, abbreviations, units) 2. Propose and apply a single standard format for each column: [SPECIFY TARGET FORMATS WHERE KNOWN, e.g. dates as YYYY-MM-DD] 3. Flag rows that look like duplicates or outliers, but do not delete them — mark them for my review instead 4. Do not alter these columns without flagging first: [COLUMNS REQUIRING REVIEW BEFORE CHANGES, e.g. customer name, ID numbers] CONSTRAINTS: - Preserve every original row unless I confirm a deletion - Do not invent or infer missing values — leave them blank and flag them - [ANY ADDITIONAL CONSTRAINT, e.g. keep a specific column's original casing] OUTPUT FORMAT: 1. The cleaned dataset as a table 2. A change log listing each column, what inconsistency was found, and what standard was applied 3. A separate list of flagged rows (possible duplicates/outliers) with a one-line reason for each flag

Want it sharper? Optimize this prompt with Prompt Optimizer, check it with the Prompt Debugger or shorten it with the Token Optimizer.

Example input

example-input
246 tokens
ROLE: You are a data cleaning assistant helping standardize a spreadsheet dataset for analysis. CONTEXT: Below is a sample of the dataset. Columns are: Customer Name, State, Signup Date, Plan John Smith, NY, 03/14/2024, pro john smith , new york, 2024-03-14, Pro Maria Garcia, CA , 14-03-2024, PRO Maria Garcia, California, 03/14/24, pro David Chen, TX, 3/14/2024, Basic TASK: 1. Review each column and identify formatting inconsistencies 2. Propose and apply a single standard format for each column: dates as YYYY-MM-DD, state as two-letter abbreviation, plan name capitalized 3. Flag rows that look like duplicates or outliers, but do not delete them 4. Do not alter the Customer Name column's spelling without flagging first CONSTRAINTS: - Preserve every original row unless I confirm a deletion - Do not invent or infer missing values OUTPUT FORMAT: 1. The cleaned dataset as a table 2. A change log 3. A list of flagged rows with reasons

When to use it

  • Cleaning a CSV or spreadsheet export from a form tool, CRM, or survey platform before importing it into another system
  • Standardizing inconsistent entries (like "NY", "N.Y.", and "New York" all referring to the same value) across a column
  • Preparing a dataset for analysis or a dashboard where formatting inconsistencies would otherwise skew grouping or filtering
  • Getting a second pass on a dataset you've already partially cleaned, to catch anything you missed

Best practices

  • Paste a representative sample of the data (including any known problem rows) rather than just the first few clean-looking rows, so the model sees the actual range of inconsistencies
  • Tell the model which columns are safe to standardize automatically versus which ones need your review before changing (like customer names, where merging duplicates has business consequences)
  • Ask for a change log alongside the cleaned data so you can audit exactly what was altered
  • Spot-check the cleaned output against a few rows of your original data before using it, since the model can misjudge an edge case (like two genuinely different customers with similar names)

Common mistakes

  • Asking the model to "just clean this up" without specifying target formats, which leads to inconsistent judgment calls
  • Letting the model silently delete rows it thinks are duplicates instead of flagging them for review
  • Pasting a huge dataset in one block and expecting perfect accuracy — very large datasets are better cleaned in batches with spot checks between them
  • Not specifying date, currency, or unit formats, resulting in a mix of formats that still don't match your target system

FAQs

How do I use AI to clean messy spreadsheet data?

Paste a representative sample of your data into a prompt that specifies target formats for each column, asks the model to flag (not delete) likely duplicates, and requests a change log so you can review exactly what was altered.

Can ChatGPT or Claude fix inconsistent dates and formatting in a CSV?

Yes, both can read pasted tabular data and reformat columns like dates, states, and capitalization to a standard you specify, though you should always spot-check the output against your original file.

Will AI automatically remove duplicate rows from my dataset?

It shouldn't without your approval. This prompt explicitly tells the model to flag possible duplicates and outliers for review rather than deleting them, since only you know the business context behind a borderline case.

What's the best way to clean a large spreadsheet with AI without losing data?

Break the dataset into smaller batches, specify exact target formats for each column upfront, and request a change log with each batch so you can verify nothing was altered incorrectly before combining the results.

Does this data cleaning prompt work in Gemini and Claude, not just ChatGPT?

Yes, the prompt structure is model-agnostic. Any model that can read pasted tabular text and follow formatting instructions can perform this kind of column-by-column standardization.

Found this prompt useful? Share it.

Share

More in Data Analysis

Data Analysis

AI Prompt to Build a Data Dictionary From a Spreadsheet or Database Table

This data dictionary prompt asks ChatGPT, Claude, or Gemini to turn a raw spreadsheet or database table into a clear reference document: eve…

You are a data analyst creating a data dictionary for a dataset so other people can understand and use it correctly.

Context:
- Source: [e.g., spreadsheet export, PostgreSQL table, CSV file]
- Table or sheet name: [NAME]
- Audience: [e.g., BI analysts, a new engineer, external partner]

Data sample (paste column headers plus 10-20 real rows below):
[PASTE SAMPLE DATA HERE]

Task:
For each column in the sample, produce:
1. Column name as it appears in the source.
2. Inferred data type (string, integer, decimal, date, boolean, categorical, etc.).
3. A one-sentence description of what the column represents, based only on the sample data.
4. Notes on anything unusual: nulls, mixed formats, inconsistent units, likely key or foreign key, or values that look like placeholders.
5. A confidence level (High, Medium, Low) for how certain you are about the description.

Constraints:
- Do not state a description as certain if the sample doesn't clearly support it; use Medium or Low confidence instead.
- Call out any columns that look like duplicates of each other or likely primary/foreign keys in a separate summary section.
- Keep descriptions to one sentence each.

Output format:
A single Markdown table with columns: Column Name | Data Type | Description | Notes | Confidence, followed by a short 'Keys and Relationships' summary section.

Make this prompt yours

Data Analysis

AI Prompt to Query and Analyze Supabase Data via Supabase's MCP Server

This prompt is for teams running Claude or ChatGPT with Supabase's MCP server connected, so the model can read a live Postgres database dire…

You are a data analyst with read-only access to a Postgres database through an MCP database connection. Follow these rules for every request:

ROLE
- Act as a careful analyst who verifies before concluding.

CONTEXT
- Database: [DATABASE NAME]
- Relevant tables: [TABLE NAMES, e.g. users, subscriptions, events]
- Business question: [QUESTION, e.g. how many trial users converted to paid in the last 30 days]

CONSTRAINTS
- Only run read-only SELECT queries. Never run INSERT, UPDATE, DELETE, or DDL statements.
- Before answering, list the exact query or queries you plan to run and wait for confirmation if any query touches more than [ROW LIMIT] rows.
- If a referenced table or column does not exist, say so explicitly instead of guessing a substitute.
- Show a sample of up to 5 returned rows alongside any aggregate numbers.

OUTPUT FORMAT
1. Queries run (as SQL)
2. Row counts and sample data
3. Plain-language answer to the business question
4. Any caveats about data quality or missing values

Task: [SPECIFIC ANALYSIS REQUEST]

Make this prompt yours

Data Analysis

AI Prompt to Find Correlations and Trends Across Multiple Metrics in a Dataset

This prompt is for analysts, marketers, and founders who need to find correlations and trends across multiple metrics in a dataset without w…

Role: You are a data analyst who specializes in identifying patterns across business metrics.

Context:
- Dataset: [PASTE_DATA_OR_DESCRIBE_COLUMNS]
- Metrics to analyze: [LIST_OF_METRIC_COLUMNS]
- Time period covered: [TIME_PERIOD]
- Business context: [BRIEF_DESCRIPTION_OF_WHAT_THESE_METRICS_MEASURE]

Task:
Analyze the relationships between the listed metrics and identify:
1. Which pairs of metrics show a notable positive or negative relationship
2. The approximate strength of each relationship (strong, moderate, weak)
3. A plain-language explanation of what the relationship might mean in this business context
4. Any relationship that looks correlated but is more likely coincidental or explained by a third factor

Constraints:
- Clearly label every finding as correlation, not causation, unless a controlled comparison is explicitly provided
- Do not report relationships based on fewer than [MINIMUM_DATA_POINTS] data points
- Flag any missing or inconsistent data that could affect the reliability of a finding

Output format:
A summary paragraph followed by a numbered list of relationships, each with strength, explanation, and a caution note where relevant.

Make this prompt yours