Clear the backlog: 10 Codex prompts for your own files

sheet-merger

five messy spreadsheets turned into one clean list

How to use it

Codex only. Nothing else to install. Save the prompt as a file and run it, or paste it straight into Codex.

codex exec -C "your folder" - < the-prompt.md

It does the whole job in one pass on your own machine and writes the result into the folder you pointed it at.

The prompt

---
name: sheet-merger
description: Turns several spreadsheets or CSV exports with different columns into one clean list, plus a report of what did not map and a file holding every row that was not merged.
---

# Five messy spreadsheets, one clean list, and nothing lost

You point it at a folder of spreadsheets. You get back one merged file with the columns you agreed, a plain report of what did not map, and a separate file containing every row that did not make it, with the reason written next to it.

Run it on your own machine, over your own files, in one pass:

```
codex exec -C "the folder" - < the-prompt.md
```

## What it does

1. **Inventory before anything is merged:** open every file in the folder, and write `01-inventory.csv` listing one row per source file with the file name, sheet name, the row number the real header sits on, the number of data rows, and every column heading exactly as written. Never assume the header is row 1: exports from tills, banks and booking systems commonly put a title and a blank row above it.
2. **Write the column map and stop:** create `02-column-map.csv` with four columns, `source_file`, `source_column`, `target_column`, `confidence`, where confidence is one of `exact`, `renamed`, `guessed` or `unmapped`. Every heading found in step 1 appears exactly once. Anything marked `guessed` or `unmapped` is listed in the report for the owner to correct. Nothing is merged until this file exists.
3. **Pick the target columns from the fullest file, not the first one:** the agreed column set comes from whichever source has the fewest empty cells across the columns it shares with the others, because the first file in a folder is usually just the oldest. Say in the report which file it came from.
4. **Read every cell as text:** identifiers keep their leading zeros. A UK postcode, a phone number starting 0, a sort code, a barcode and a product code all become wrong numbers the moment a spreadsheet reader guesses they are numeric, and `1/2` silently becomes a date. Convert to a number only for a column the owner has named as a number.
5. **Normalise only two things, and nothing else:** dates are written `YYYY-MM-DD`, and leading or trailing spaces are trimmed. Broman and Woo's spreadsheet guidance singles out `YYYY-MM-DD` because every other order is ambiguous between countries. Do not retitle, re-case, reformat currency or "tidy" names: that is editing the owner's data without being asked.
6. **Put every rejected row in `04-not-merged.csv`, never in the bin:** each rejected row is written out whole, with three extra columns added at the front, `source_file`, `source_row_number` and `reason`. Reasons are specific, for example `no value in the key column` or `column count does not match the header`. A row is never dropped, never quietly repaired, and never counted twice.
7. **Handle duplicates by moving them, not merging them:** ask the owner which column is the key, for example email or product code. The first occurrence goes to the clean file, later ones go to `05-duplicates.csv` with their source file and row number. Never combine two rows into one, because you cannot tell which of two conflicting phone numbers is the current one.
8. **Mark missing cells with a code and a key:** a cell that has no value gets `[x]` if the source never held it, and `[z]` if the column does not apply to that source. The report carries the key. The UK Government Analysis Function guidance is explicit that a dash or a full stop is not good enough, since neither says why the cell is empty.
9. **Write the report last, in `03-report.md`:** the target columns and where they came from, every `guessed` and `unmapped` heading, the row arithmetic from the checks below, the missing-value key, and one worked example of a merged row shown beside its source rows.

## Then it checks

1. The row arithmetic balances exactly: rows in the clean file, plus rows in `04-not-merged.csv`, plus rows in `05-duplicates.csv`, equals the total data rows counted in `01-inventory.csv`. Print the sum in the report. If it does not balance, a row was lost.
2. Every heading in `01-inventory.csv` appears exactly once in `02-column-map.csv`, and nothing appears in the map that was not in the inventory.
3. The clean file has one header row, no blank rows, no blank columns and no merged cells, which is what the Analysis Function guidance requires of a table anyone else has to read.
4. Five rows chosen at random from the clean file are compared cell by cell against the source file and row number they came from. Every value matches character for character.
5. The longest identifier in the file still has all its characters, and any value that began with a zero still begins with a zero.
6. Every row in `04-not-merged.csv` has a reason written in it, and no reason is blank or says only "error".

Any check fails: name it, redo that step once. Failed twice: say what is wrong and stop.

## Rules
- Public information only. This job needs no internet: the files stay on the owner's machine, and nothing is uploaded, emailed or pasted into any online service.
- Never invent a fact, a number or a quote. An empty cell stays empty and gets a marker. Never fill a gap with a likely value, a lookup from another row, or an average.
- **Never silently drop a row.** If a row cannot go in the clean file it goes in `04-not-merged.csv` with a reason. A merge that ends with fewer rows than it can account for has failed, however clean the output looks.
- Never write to, rename or re-save a source file. All output goes into a new folder, and the source folder is opened read only.
- If the sheets hold personal details such as names, emails or phone numbers, say so in the report. A merged list of people is personal data under UK GDPR, and the merge may change what it can lawfully be used for. This skill prepares the file so a professional can check it. It is not legal advice, and it must never be presented as such.

## Built from
- anthropics/skills, the `xlsx` skill, https://github.com/anthropics/skills/blob/main/skills/xlsx/SKILL.md, 174,998 stars read from GitHub on 7 September 2026: took its instruction to follow the spec literally with exact column headers, its rule that every assumption and hardcoded number is documented where the reader will see it, and its warning that a run finishing without errors proves the steps executed, not that the result is right.
- CSV Data Summarizer by @coffeefuelbump, https://github.com/coffeefuelbump/csv-data-summarizer-claude-skill, found through the ComposioHQ skills directory at https://github.com/ComposioHQ/awesome-claude-skills, which showed 74,627 stars when read from GitHub on 7 September 2026: took its one-pass behaviour, inspect the file and produce the whole result without stopping to ask what the owner wants, and its missing-data reporting. Rejected its habit of generating charts, which is not what a merge is for.
- Broman KW and Woo KH, "Data organization in spreadsheets", The American Statistician, 2018, tutorial at https://kbroman.org/dataorg/: took the `YYYY-MM-DD` date rule, one thing per cell, make it a rectangle, and never use font colour or highlighting as data.
- UK Government Analysis Function, "Releasing statistics in spreadsheets", published 30 June 2021, https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/: took "Remove all blank rows and blank columns within tables", "Restructure your tables so there are no split cells, merged cells or nested tables", and the shorthand markers with a key instead of dashes or full stops for missing values.

Built from the best public work on this

Sources for sheet-merger

Every source below was opened on 7 September 2026. Star counts were read from GitHub's own star counter on the repository page, which carries the exact figure in its `aria-label` and `title` attributes, for example `aria-label="174998 users starred this repository"`. The `api.github.com` endpoint was returning HTTP 403 "API rate limit exceeded" from this machine at the time, so the counter was used instead. Both report the same number.

anthropics/skills, the xlsx skill

https://github.com/anthropics/skills, 174,998 stars, read 7 September 2026. The skill file itself is at https://github.com/anthropics/skills/blob/main/skills/xlsx/SKILL.md and was read in full.

It is the reference implementation for handling a spreadsheet as a deliverable rather than as a pile of numbers. Three of its instructions shaped this skill directly. First, "Follow the user's spec literally. Exact tab names, exact column headers, and the formula they spelled out. A redesign that computes something else fails, however elegant." That is why step 3 of sheet-merger agrees a target column set and writes it down before merging, instead of inventing a tidier set of headings. Second, its requirement to "Document every assumption and hardcoded number where the reader will see it" became the `03-report.md` step, where the guessed and unmapped headings are listed by name rather than buried. Third, its warning that "A green recalc proves your formulas evaluate, not that they are right" is the reason the checks section counts rows and compares five real rows against their sources, rather than treating a run that finished without an error as a successful merge.

Also taken from it, indirectly: its insistence that when you edit an existing file you match its conventions exactly. In a merge that translates to reading every cell as text and normalising only dates and stray spaces, because everything else is the owner's convention, not ours.

CSV Data Summarizer, by @coffeefuelbump

https://github.com/coffeefuelbump/csv-data-summarizer-claude-skill, found through the ComposioHQ skills directory at https://github.com/ComposioHQ/awesome-claude-skills, which showed 74,627 stars when read on 7 September 2026. The star count belongs to the directory repository, not to the skill repository, whose own count could not be read while the API was rate limited. Both the SKILL.md and the README were read.

The directory entry describes it as a skill that "Automatically analyzes CSV files and generates comprehensive insights with visualizations without requiring user prompts". Its SKILL.md is unusually blunt about that behaviour: it tells the agent not to ask what the owner wants to do with the data, not to offer options, and to run the whole analysis immediately. That is where sheet-merger's one-pass shape comes from. The owner runs one command over a folder and gets the finished set of files, rather than a conversation.

Two things were taken more specifically: its automatic missing-data reporting, which became step 8's missing-value markers and key, and its habit of inspecting the data structure first and deciding what to do from what is actually in the file, which became the inventory step that finds the real header row instead of assuming row 1.

One thing was deliberately rejected. That skill's main output is charts. A merge does not need charts, and generating them would bury the only thing the owner has to check, which is what did not map and which rows did not make it.

Broman KW and Woo KH, "Data organization in spreadsheets"

The American Statistician, 2018. Tutorial version read at https://kbroman.org/dataorg/ on 7 September 2026.

This is the most cited plain-English statement of what a usable spreadsheet looks like, written for people who are not programmers. Its numbered rules include "Be consistent", "Write dates as YYYY-MM-DD", "Fill in all of the cells", "Put just one thing in a cell", "Make it a rectangle", "No calculations in the raw data files" and "Don't use font color or highlighting as data".

Two decisions came from it. The `YYYY-MM-DD` rule in step 5 is taken verbatim, and it is the only date format the skill will write, because any other order is ambiguous between the UK and the US and a merged file usually mixes sources from both. "Make it a rectangle" is why check 3 refuses blank rows, blank columns and merged cells in the output: a merged file that is not a clean rectangle cannot be imported anywhere afterwards. "Fill in all of the cells" is the reason empty cells are marked rather than left bare, though the marker itself comes from the next source.

UK Government Analysis Function, "Releasing statistics in spreadsheets"

Published 30 June 2021. https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/, read 7 September 2026.

This is the UK public sector's own standard for publishing a spreadsheet that other people have to read, and it is stricter than anything in the commercial world. Three of its rules are used.

"Remove all blank rows and blank columns within tables", with the reason given that a blank "may be perceived as the edge of the data area rather than a divider", became check 3. "Restructure your tables so there are no split cells, merged cells or nested tables" became the rest of check 3, since merged cells are the single commonest reason a merged file cannot be re-imported.

The missing-value handling in step 8 is taken from its guidance on shorthand. It states plainly that where there are several reasons a cell may be blank you need shorthand to explain which one applies, and it advises against dashes and full stops, recommending bracketed codes such as `[x]` with a key provided alongside the table. Sheet-merger uses `[x]` for a value the source never held and `[z]` for a column that does not apply to that source, with the key printed in the report.

Best public prompt we found for this job

The strongest public artefact is the **xlsx SKILL.md in anthropics/skills** (174,998 stars), because it is the only one of the four that is written as instructions to a machine rather than advice to a human, and it is the only one that treats "the run finished" and "the answer is right" as different claims.

The one line worth copying verbatim into any spreadsheet prompt:

"Follow the user's spec literally. Exact tab names, exact column headers, and the formula they spelled out. A redesign that computes something else fails, however elegant."

Want this running in your business?

I optimise how businesses run — your sales, your visibility, your social media — and build bespoke software where nothing off the shelf fits. The first conversation is free. Work starts from £150 a day.