
Statement Sorter — Categorized Monthly Table
Statement Sorter — Bank Lines to a Categorized Monthly Table
Send bank or card statement rows (CSV) and the category names or keyword rules you want. Get a categorized row table, monthly category totals, and the addition formula for each total.
This local command-line tool reads UTF-8 CSV with date, description, and amount. It supports Python 3.9 and newer, does not connect to a bank, and makes no accounting or tax recommendations. Amount text is preserved in output; totals use decimal arithmetic. Amount inputs may use a period decimal, comma digit grouping, full-width digits, or a leading ¥/$; unmatched descriptions are marked Review unless a whole keyword matches.
Run
python3 scripts/statement_sorter.py examples/statement.csv --output /tmp/sorted.csv
Run package tests from this directory with python3 -m pytest -q tests (pytest required).
Options
| Option | Purpose |
|---|---|
--format csv|markdown|json |
Choose output format |
--rules categories.json |
Set category keywords |
--month YYYY-MM |
Filter one month |
--category NAME |
Filter category; repeatable |
--min-amount N / --max-amount N |
Filter absolute amounts |
--review-only |
Keep uncategorized rows |
--list-categories |
Show built-in categories |
Totals are grouped by month only for valid calendar dates written as YYYY-MM-DD. Dates that do not match that form, including impossible dates such as 2026-13-01 or 2026-02-30, remain visible under Unparsed date. A Review category signals a manual decision; it does not guess.
Input contract
UTF-8 CSV only. Required columns are date, description, and amount. Supported aliases include memo/details and transaction_date. Amounts accept a period decimal, optional comma digit grouping (for example, 1,200.00), full-width digits, or a leading ¥/$. The original amount text stays in the output; totals use its parsed numeric value. Other currency symbols, locale-specific decimal commas, and malformed grouping are unsupported. Unreadable or unsupported files return one error: line with exit code 2.


