Merge many files into one, or split one file into many, in ONE command: combine several CSV or Excel files (or all sheets of a workbook) into one table with the header once and an optional 'source' column; join two tables on a shared key (customer number, e-mail, product id); split a big CSV/Excel into one file per value of a column (per region, per month, per salesperson) or into chunks of N rows; concatenate text or Markdown files. Use for: merge these 12 exports, combine monthly files, put all sheets in one, split this list per department, match these two lists on e-mail, join customers with orders. Triggers: merge, combine, concatenate, join, match two lists, split by, one file per, chunks.
Say it in your own words; the assistant finds this recipe by itself. Examples:
Merge many files into one, or split one file into many, in ONE command: combine several CSV or Excel files (or all sheets of a workbook) into one table with the header once and an optional 'source' column; join two tables on a shared key (customer number, e-mail, product id); split a big CSV/Excel into one file per value of a column (per region, per month, per salesperson) or into chunks of N rows; concatenate text or Markdown files. Use for: merge these 12 exports, combine monthly files, put all sheets in one, split this list per department, match these two lists on e-mail, join customers with orders. Triggers: merge, combine, concatenate, join, match two lists, split by, one file per, chunks.
python3 /skills/merge-split-files/scripts/files.py <verb> … — inputs in /work/in, results in
/work/out. CSV, TSV, XLSX and TXT/MD are understood from the extension. Every verb prints one
OK … line (with row counts) or ERROR ….
| Need | Command |
|---|---|
| Merge tables (header once) | files.py merge /work/out/all.xlsx /work/in/jan.csv /work/in/feb.csv /work/in/mar.xlsx [--source] |
| Merge every sheet of a workbook | files.py merge /work/out/all.csv /work/in/book.xlsx --all-sheets [--source] |
| Merge text / Markdown files | files.py merge /work/out/all.md /work/in/*.md [--source] (adds a heading per file) |
| Split by a column's value | files.py split /work/in/sales.csv /work/out/by-region --by region → by-region/DK.csv, NO.csv … |
| Split every N rows | files.py split /work/in/sales.csv /work/out/parts --every 5000 |
| Join two tables on a key | files.py join /work/out/joined.xlsx /work/in/customers.csv /work/in/orders.csv --on customer_id [--how left|inner|outer] |
| Join when the key is named differently | … --left-on Email --right-on email_address |
--source adds a column source (the file or sheet the row came from).merge aligns columns by name; a column missing in one file is left empty there.split --by writes one file per distinct value (same type as the input unless you add --as xlsx)..csv or .xlsx).Tell the person the row counts from the OK line and give them the links.
SKILL.mdscripts/__pycache__/files.cpython-311.pycscripts/files.pyWritten by Percerno, MIT licence.