Skip to content

CLI Reference

The bsp command-line tool provides subcommands for processing bank statement PDFs and anonymising PDF files. Install the package to get the bsp entry point:

pip install uk-bank-statement-parser

bsp forex

Fetches daily USD-based exchange rates for all currencies found in DimAccount plus any extras specified, forward-fills weekend and holiday gaps, and writes the results to the exchange_rates table. Provider and API key can be configured via forex_api_config.toml in the project config directory.

bsp forex [--project PATH] [--currencies CODE] [--api-key KEY]

Options

Option Default Description
--project auto-detect Project folder path (default: ./bsp_project/ in CWD).
--currencies auto-detect Additional ISO 4217 currency codes to fetch (e.g. --currencies AED SAR).
--api-key auto-detect Override the API key from forex_api_config.toml.

bsp anonymise

Start from a completely scrambled PDF (every letter replaced) and use anonymise.toml to specify exclusions — text that should remain readable (transaction type codes, account descriptions, etc.) and numbers that should be scrambled. Driven by anonymise.toml in the project config directory.

bsp anonymise PATH [--folder] [--pattern GLOB] [--output OUT_FILE] [--output-dir OUT_DIR] [--config CONFIG_TOML]

Positional arguments

Argument Description
PATH PDF file to anonymise, or a folder when --folder is set.

Options

Option Default Description
--folder off Treat PATH as a directory and anonymise all matching PDFs inside it.
--pattern *.pdf Glob pattern for PDF discovery when --folder is used (default: '*.pdf').
--output auto-detect Output path for single-file mode (default: anonymised_.pdf alongside input).
--output-dir auto-detect Output directory for --folder mode (default: alongside each source file).
--config auto-detect Path to a custom anonymise.toml (default: project config directory).

bsp process

Discover PDF bank statements, extract transaction data, persist results to Parquet and/or SQLite, copy source PDFs into the project tree, and export reports as Excel, CSV, JSON, and/or CSV reporting feeds. A project folder is created automatically if it does not exist.

bsp process [--project PATH] [--pdfs PATH] [--pattern GLOB] [--no-turbo] [--company KEY] [--account KEY] [--data {parquet,database,both}] [--export-format {excel,csv,json,all,reporting}] [--export-type {single,multi}] [--no-export] [--no-copy] [--batch-id ID] [--filename-timestamp]

Options

Option Default Description
--project auto-detect Project folder path. Created if absent (default: ./bsp_project/ in CWD).
--pdfs auto-detect Folder to scan for PDF files (default: current working directory).
--pattern **/*.pdf Glob pattern for PDF discovery (default: '*/.pdf').
--no-turbo off Disable parallel processing (turbo is enabled by default).
--company auto-detect Company key for config lookup (default: auto-detect from PDF).
--account auto-detect Account key for config lookup (default: auto-detect from PDF).
--data both Persistence target for update_data() (default: 'both'). Choices: parquet, database, both.
--export-format all Export file format (default: 'all'). Choices: excel, csv, json, all, reporting.
--export-type single Export preset. 'single' (default) exports a single flat transactions table. 'multi' exports separate star-schema tables (accounts, calendar, statements, transactions, balances, gaps) intended for loading into an external database. Choices: single, multi.
--no-export off Skip the export step entirely.
--no-copy off Skip copying source PDFs into the project statements/ directory.
--batch-id auto-detect Filter exports to a single batch identifier (default: export all batches).
--filename-timestamp off Append a human-readable timestamp (yyyymmddHHMMSS) to exported filenames. For multi exports (CSV/JSON) a timestamped sub-folder is created instead.

Examples

Process all PDFs in a folder

bsp process --pdfs ~/statements

Process with a specific project folder

bsp process --pdfs ~/statements --project ~/my_project

Persist to database only, skip export

bsp process --pdfs ~/statements --data database --no-export

Anonymise a single PDF

bsp anonymise statement.pdf

Anonymise all PDFs in a folder

bsp anonymise ~/statements --folder