Excel (.xlsx) writer for camt053-parsed ISO 20022 bank statements.
Project description
camt053-writer-xlsx: Excel writer for parsed camt.053 statements
An Excel .xlsx writer for camt053-parsed ISO 20022 bank
statements — turn a ParsedDocument into a four-sheet workbook
(Metadata, Balances, Entries, Reversals) that accountants, auditors,
and reconciliation macros can consume directly.
Latest release: v0.0.1 — single
write_xlsx(document, path)function, 100% line + branch coverage, 100% docstring coverage.
Contents
- Overview
- Install
- Quick Start
- Sheets
- Examples
- The camt053 suite
- When not to use camt053-writer-xlsx
- Development
- Security
- Documentation
- License
- Contributing
- Acknowledgements
Overview
camt053-writer-xlsx is a small, focused companion to the camt053
ISO 20022 cash-management library. It does one thing well: given a parsed
camt.053 document, write a multi-sheet Excel workbook in a stable column
layout so downstream tooling can target columns by name without parsing
the document model.
This package is part of the camt053 suite — a set of independently
installable packages that share the camt053.services layer:
camt053— the core library (CLI + REST API)camt053-mcp— the Model Context Protocol server for AI agentscamt053-lsp— the Language Server Protocol server for editorscamt053-writer-xlsx— this package, the Excel writer
Install
camt053-writer-xlsx runs on macOS, Linux, and Windows and requires
Python 3.10+ and pip. It pulls in camt053 and openpyxl
automatically.
pip install camt053-writer-xlsx
Quick Start
from camt053 import parse_document
from camt053_writer_xlsx import write_xlsx
with open("statement.xml") as fh:
document = parse_document(fh.read())
write_xlsx(document, "statement.xlsx")
That's a four-sheet Excel workbook ready for your accountant.
Sheets
| Sheet | Granularity | Use |
|---|---|---|
| Metadata | One row per statement | Header fields, account identifiers, balance / entry counts |
| Balances | One row per balance | Type code, amount, currency, credit/debit indicator, date |
| Entries | One row per (entry, detail) pair |
Flattened so pivot tables and accounting macros work directly |
| Reversals | Filter of Entries | Entries with reversal_indicator=True or any return reason code |
The column layout is stable across releases; downstream tooling can target columns by name without parsing the document model. Multi-detail entries are flattened (an entry with N transaction details produces N rows that share the entry-level columns), so the workbook stays rectangular for spreadsheet consumers.
Examples
Two runnable examples live in examples/:
01_minimal_write.py— parse a camt.053 XML string and write it to Excel.02_filter_reversals.py— build aParsedDocumentprogrammatically and inspect the Reversals sheet.
Both are exercised in CI on every commit.
The camt053 suite
camt053-writer-xlsx is part of a set of independently installable
packages built around the camt053 library — pick whichever
ones your stack needs:
| Package | Role |
|---|---|
camt053 |
Core library + CLI + FastAPI REST API |
camt053-mcp |
Model Context Protocol server (for AI agents) |
camt053-lsp |
Language Server Protocol server (for editors) |
camt053-writer-xlsx |
Excel .xlsx writer (this package) |
camt053-loader-mt940 |
SWIFT MT940 → camt.053 loader |
flowchart LR
A["camt.053 XML"] -->|parse_document| B["camt053"]
B -->|ParsedDocument| C["camt053-writer-xlsx"]
C -->|.xlsx workbook| D["Accountants / auditors"]
When not to use camt053-writer-xlsx
- You need a custom sheet layout. The four-sheet structure (Metadata / Balances / Entries / Reversals) is stable by design so downstream tooling can target columns by name. Forking the writer is the right move if your downstream needs differ.
- You need
.xls(legacy binary).openpyxlwrites.xlsxonly; convert downstream if you must. - You need encrypted output. Out of scope; encrypt the produced
.xlsxdownstream with a tool likemsoffcrypto-tool. - You want to read Excel. This package is a writer. The
inverse direction (
.xlsx→ camt.053) is not currently in the suite; open an issue if you'd find it useful.
Development
git clone https://github.com/sebastienrousseau/camt053-writer-xlsx
cd camt053-writer-xlsx
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest # 100% line + branch coverage gate
interrogate camt053_writer_xlsx # 100% docstring gate
mypy camt053_writer_xlsx # strict
Security
camt053-writer-xlsx consumes already-parsed data, not raw XML — the
XXE / billion-laughs surface lives upstream in the camt053 core.
Reporting practice, supported versions, and supply-chain posture
(PyPI Trusted Publishing, sigstore attestations, signed tags) are
documented in SECURITY.md. Vulnerabilities go via
GitHub Private Vulnerability Reporting, not public issues.
Documentation
README.md— this fileCHANGELOG.md— release notesSECURITY.md— disclosure + supported versionsSUPPORT.md— how to get helpMAINTAINERS.md— who can mergeexamples/— runnable scripts, exercised in CI
License
Licensed under the Apache License, Version 2.0. Any contribution submitted for inclusion shall be licensed as above, without additional terms.
Contributing
Contributions are welcome — open an issue or PR on the repository.
Acknowledgements
Built on the camt053 ISO 20022 Bank Statement library and
openpyxl.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file camt053_writer_xlsx-0.0.8.tar.gz.
File metadata
- Download URL: camt053_writer_xlsx-0.0.8.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f40212e9414a59eb2a0305958297ac8d2924d5b148317c4cac8121384504e15e
|
|
| MD5 |
e7be9fcaf1e5fc5431146314ade6d33a
|
|
| BLAKE2b-256 |
6abd2f38cde5150be2556d50d5b5df8e681984a9ffda73ea9ae4a3a4f5fd9014
|
Provenance
The following attestation bundles were made for camt053_writer_xlsx-0.0.8.tar.gz:
Publisher:
release.yml on sebastienrousseau/camt053-writer-xlsx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
camt053_writer_xlsx-0.0.8.tar.gz -
Subject digest:
f40212e9414a59eb2a0305958297ac8d2924d5b148317c4cac8121384504e15e - Sigstore transparency entry: 1970324511
- Sigstore integration time:
-
Permalink:
sebastienrousseau/camt053-writer-xlsx@0763424ee759c9d118e9b9c0a844e4b8bf4e6f18 -
Branch / Tag:
refs/tags/v0.0.8 - Owner: https://github.com/sebastienrousseau
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0763424ee759c9d118e9b9c0a844e4b8bf4e6f18 -
Trigger Event:
push
-
Statement type:
File details
Details for the file camt053_writer_xlsx-0.0.8-py3-none-any.whl.
File metadata
- Download URL: camt053_writer_xlsx-0.0.8-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8704bd77aa7ec5953172962b615ae24a0f85adde0d49a8f52101be7a92faf5a
|
|
| MD5 |
b197cf970c5030e730e27714950f8fd9
|
|
| BLAKE2b-256 |
0d38f476eb4af26f74a03f27534b3fea353484c05f02165042cb1ed980178e09
|
Provenance
The following attestation bundles were made for camt053_writer_xlsx-0.0.8-py3-none-any.whl:
Publisher:
release.yml on sebastienrousseau/camt053-writer-xlsx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
camt053_writer_xlsx-0.0.8-py3-none-any.whl -
Subject digest:
f8704bd77aa7ec5953172962b615ae24a0f85adde0d49a8f52101be7a92faf5a - Sigstore transparency entry: 1970324691
- Sigstore integration time:
-
Permalink:
sebastienrousseau/camt053-writer-xlsx@0763424ee759c9d118e9b9c0a844e4b8bf4e6f18 -
Branch / Tag:
refs/tags/v0.0.8 - Owner: https://github.com/sebastienrousseau
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0763424ee759c9d118e9b9c0a844e4b8bf4e6f18 -
Trigger Event:
push
-
Statement type: