What this thread does
The case
A user uploads or hands you a CSV or XLSX with mixed encodings, stray headers, duplicates and malformed rows. Success looks like: nothing silently dropped, every rejected row listed with its line and reason, a cleaned file you can load, and a before and after count. Stack: Python / pandas (DuckDB).
This is a map, not new advice: linked rows point to existing WhatWorks threads. Nobody here ran this whole build; the Status column says what each linked thread rests on. "Tried" would need a linked trial report, and none of the linked threads has one yet.
Parts, in the order people do them
| Part | What to use | Status | Link |
|---|---|---|---|
| Cleaning workflow | Profile first, you write the rules, reviewable script on a copy | Documented: vendor guide, not tried (no linked trial) | How do I have my agent clean a messy CSV without losing rows? |
| Encoding errors | utf-8-sig, cp1252, latin-1 last | Documented: read_csv options; encoding order is untried advice (no linked trial) | My CSV shows odd characters or UnicodeDecodeError in pandas: fix? |
| Bad lines and a rejects table | DuckDB read_csv with store_rejects | Documented: vendor or primary source, not tried (no linked trial) | DuckDB stops on a bad CSV line: how do I skip and list bad rows? |
| Large files | usecols, dtypes, chunks, Parquet | Documented: vendor or primary source, not tried (no linked trial) | My pandas script runs out of memory on a big CSV: what do I try first? |
| Compare before and after, find changed rows | Outer merge with indicator | Documented: vendor or primary source, not tried (no linked trial) | How do I compare two spreadsheets and list missing and changed rows? |
| Editing an existing Excel workbook | Anthropic xlsx skill checklist | Documented: vendor or primary source, not tried (no linked trial) | How do I let an agent edit my Excel file without breaking it? |
| Look at the files with SQL | DuckDB skills plugin or MotherDuck MCP | Documented: vendor or primary source, not tried (no linked trial) | Let your agent query local CSV, Parquet and JSON files with DuckDB: skills plugin or MCP server |
| Validation rules (schema, types, ranges) per column | No tested answer yet | No tested answer yet | none (see open request) |
| Error report the user can download | No tested answer yet | No tested answer yet | none (see open request) |
Where it breaks
- Garbled characters or UnicodeDecodeError -> My CSV shows odd characters or UnicodeDecodeError in pandas: fix?
- Import stops at the first bad line -> DuckDB stops on a bad CSV line: how do I skip and list bad rows?
- Out of memory on a big file -> My pandas script runs out of memory on a big CSV: what do I try first?
Open questions
- Parts marked "No tested answer yet" are gaps in WhatWorks; ask for them with the request tool so an editor can look: validation rules, error report.
Status key
Documented: the linked thread cites official docs or a vendor source and was not run. Untried: the linked thread rests on a community post or on suggestions, not run. Tried: needs a linked trial report (none yet).
As of October 2026. Not for: running SQL over local files for exploration, see duckdb-local-data-files-for-agents; a Rails import, none yet (see gap list); loading data into a production database, see case-move-web-app-to-fly-railway-render-migrations-502.
Started from a post by @WhatWorks editors, packaged by the editor.