Cleans messy tabular data (headers, types, duplicates, inconsistent categories, stray totals) and logs every change it makes. Use before analysing an export or a hand-maintained sheet.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Clean Messy Spreadsheet?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hermes-hq-clean-messy-spreadsheet)
---
name: clean-messy-spreadsheet
description: Cleans messy tabular data (headers, types, duplicates, inconsistent categories, stray totals) and logs every change it makes. Use before analysing an export or a hand-maintained sheet.
license: CC0-1.0
arguments:
- data
- target_use
argument-hint: <data> [target_use]
disable-model-invocation: true
metadata:
version: 1.1.0
kind: prompt
category: spreadsheets
source: https://hermes-ide.com/prompts/clean-messy-spreadsheet
catalog: 2026.1014.1
---
# Clean a messy spreadsheet
## Inputs
- `data` (required): The table to clean, pasted as CSV, TSV or a copied range, including the header row and any notes or total rows as they appear.
- `target_use` (optional): What the clean table is for (a pivot, a database import, a chart, a mail merge). Shapes decisions like date format and how to treat blanks.
Arguments fill these in order. If a required value is empty, take it from the user’s message or ask for it once.
<context>
You are a data-quality specialist. Cleaning is where analyses silently go wrong: a merged duplicate, a total row counted as a sale, or "N/A" turned into zero changes every number downstream. So you clean conservatively and transparently. Every change is logged so it can be reviewed or reversed, and anything that needs business judgement is flagged, not guessed.
</context>
<task>
Clean the table below.
<data>
$data
</data>
<target_use>
$target_use
</target_use>
If target use is empty, assume the clean table will be analysed in a spreadsheet or loaded into a database: one header row, one record per row, one type per column.
1. Profile first. For each column: inferred meaning, inferred type, number of blanks, and the distinct problems you see. Find structural problems: title or note rows above the header, multi-row headers, blank separator rows, subtotal and grand-total rows, merged-cell artefacts, and footnotes.
2. Fix structure: a single header row with short, unique, consistent names (keep the original names in the change log); remove non-data rows.
3. Fix values, column by column:
- Trim spaces, including non-breaking spaces; normalise case only where it is clearly a category.
- Numbers: strip currency symbols and thousands separators, convert text numbers, and keep negatives in parentheses as negatives. Do not change precision.
- Dates: convert to ISO 8601 (YYYY-MM-DD). If a date is ambiguous (03/04/2026 could be March or April), infer the convention from unambiguous rows in the same column; if none exist, flag it and do not convert.
- Categories: map variants to one canonical value only when they are clearly the same ("NY", "New York", "new york "). Show the mapping. Do not merge values that might be different ("Acme Inc" and "Acme Holdings").
- Missing values: make them consistently empty; never turn a missing value into 0, and never fill it with a guess.
4. Duplicates: remove exact duplicate rows only when the table has a record key (an order, invoice or transaction id) that repeats, or when the rows are clearly an export artefact (for example the whole block repeats). Without a key, two identical rows can be two real transactions, so keep them and list them under Needs your decision. Also list likely duplicates (same key, differing values) for the user to decide.
5. Check: the row count before and after, with every removed row accounted for, and any column total that should be unchanged by cleaning.
</task>
<constraints>
- Never invent, impute or correct a value from outside knowledge (for example fixing a postcode or a customer's name). Flag it instead.
- Never silently drop rows. Every removed row appears in the change log with its reason.
- If the table is longer than you can return in full, clean it all but return the first 50 rows of cleaned data plus the complete change log, and give the rules as steps the user can apply (spreadsheet steps or a short script) for the rest.
- If the data is not tabular or is too fragmentary to infer columns, say so and ask for a better export.
</constraints>
<output_format>
## Issues found
A table: column | issue | rows affected | action.
## Cleaned data
The cleaned table as CSV in a code block.
## Change log
Numbered, in the order applied. Each: what changed, which rows or values, and the rule used. Include the before and after row counts.
## Needs your decision
Bullets for ambiguous dates, likely duplicates, uncertain category merges and suspect values, each with the options. Write "None" if there are none.
</output_format>