camt053-writer-xlsx
Writes a parsed ISO 20022 camt.053 bank statement to a four-sheet Excel workbook with a stable column layout.
Contents
Getting started
- Install —
pip, two runtime dependencies - Requirements — toolchain floor, platforms
- Quick Start — one call from a camt053
ParsedDocumentto an.xlsxfile
The camt053-writer-xlsx ecosystem
- The camt053-writer-xlsx ecosystem — the six packages of the camt053 suite
Library reference
- Capabilities at a glance — the current surface by theme
- Ecosystem comparison — short matrix; full table at
docs/COMPARISON.md - Benchmarks — headline numbers; full table at
docs/BENCHMARKS.md - Features — module-level capability list
- Configuration — core options
- Examples — runnable example index
Operational
- When not to use camt053-writer-xlsx — limitations
- Development — make targets, CI
- Security — guarantees and compliance
- Documentation — all reference docs
- Stability guarantees — SemVer axis, output stability, minimum toolchain discipline
- License
Install
As a Python library
pip install camt053-writer-xlsx
Latest release: v0.0.26: released in lockstep with the camt053 suite at 0.0.26. The workbook is unchanged from 0.0.25.
The package pulls in camt053 (0.0.26 or newer, below 1) and
openpyxl (3.1 or newer, below 4). There is no command-line
entry point: it is a library.
Requirements
- Python 3.11 or newer, tested in CI on 3.11, 3.12, 3.13 and 3.14 on Linux (toolchain policy).
camt0530.0.26 or newer on the 0.x line, andopenpyxl3.1 or newer on the 3.x line.- Pure Python, so any platform CPython runs on; CI exercises Linux only.
Quick Start
from camt053 import parse_document
from camt053_writer_xlsx import write_xlsx
with open("statement.xml", encoding="utf-8") as fh:
document = parse_document(fh.read())
write_xlsx(document, "statement.xlsx")
write_xlsx takes any camt053.models.ParsedDocument: the one the camt053
XML parser returns, or the one camt053-loader-mt940 and
camt053-loader-mt942 build from SWIFT text. It writes four sheets,
Metadata, Balances, Entries and Reversals, and returns the output path.
The camt053-writer-xlsx ecosystem
This package is one of six in the camt053 suite. They release together at
one version, core first, and share the camt053.models data model.
| Component | Purpose | Use case |
|---|---|---|
camt053 |
Reads ISO 20022 camt.053, camt.052 and camt.054 statements and generates validated reversing entries | The core library whose ParsedDocument this writer takes |
camt053-loader-mt940 |
SWIFT MT940 customer statements to a camt.053 ParsedDocument |
A bank, ERP or middleware still emits MT940 |
camt053-loader-mt942 |
SWIFT MT942 interim transaction reports to a camt.052 ParsedDocument |
Intraday reports in MT942 |
camt053-writer-xlsx |
Writes parsed statements to Excel .xlsx |
Hand a statement to finance as a spreadsheet |
camt053-mcp |
MCP server exposing the library to AI agents | Agent workflows over statements |
camt053-lsp |
Language server for authoring camt053 reversing-entry data files | Editor support |
flowchart LR
A["camt.053 XML"] -->|parse_document| B["camt053"]
M["MT940 / MT942"] -->|loaders| B
B -->|ParsedDocument| C["camt053-writer-xlsx"]
C -->|.xlsx workbook| D["Finance, audit, reconciliation"]
Capabilities at a glance
| Area | Capability | Status |
|---|---|---|
| Workbook | Metadata, Balances, Entries and Reversals sheets, bold header row | Supported |
| Entries | One row per (entry, detail) pair; an entry without details gets one row |
Supported |
| Reversals | Entries with reversal_indicator=True or a return reason code |
Supported |
| Input | Any ParsedDocument: camt.053 XML, MT940 and MT942 via the loaders |
Supported |
| Layout | Sheet names and column order fixed across releases | Stable contract |
| Cell types | Amounts and dates written as the strings the model holds | By design; convert in the workbook |
| Formats | .xls, .csv, encrypted or signed workbooks |
Not supported |
Ecosystem comparison
The camt053 core can already export entries: camt053 entries --export csv
writes one CSV table. This package writes the whole statement, so the
header, balances and reversals travel with the entries.
| Project | Output | Sheets or tables | Balances and header |
|---|---|---|---|
| camt053-writer-xlsx | .xlsx |
Metadata, Balances, Entries, Reversals | Yes |
camt053 entries --export csv 0.0.20 |
.csv or JSON |
One entries table, 8 columns | No |
See docs/COMPARISON.md for the evidence and complete matrix.
Benchmarks
benches/bench_write_xlsx.py writes statements of growing size and reports
time, peak Python heap and file size. The number to read is peak memory:
xlsx is built in memory before anything reaches disk, so peak heap runs
around 60 to 80 times the size of the file written. Nothing asserts a
threshold, because timings are not comparable between machines; CI runs it
with --quick so it keeps working against the current API.
| Scenario | Result | Environment |
|---|---|---|
| 1,000 entries | 513.5 ms, 5.09 MB peak, 0.079 MB file | Apple A18 Pro, CPython 3.12.15, shared machine |
| 5,000 entries | 3,987.7 ms, 27.67 MB peak, 0.357 MB file | Apple A18 Pro, CPython 3.12.15, shared machine |
| Peak growth, 100 to 5,000 entries | exponent 0.90 (linear) | same run |
See docs/BENCHMARKS.md for methodology and full results.
Features
-
One function.
write_xlsx(document, path) -> Pathwrites the workbook and returns the path it wrote. The file is overwritten if it exists; the parent directory must exist. -
Four sheets, in this order.
Sheet One row per Use Metadata statement Message and statement identifiers, account, balance and entry counts Balances balance Type code, amount, currency, credit/debit indicator, date Entries (entry, detail)pairFlat, so pivot tables and accounting macros work directly Reversals (entry, detail)pair of a reversed or returned entryThe auditor's first view -
Flat entries. An entry with N transaction details produces N rows that share the entry-level columns, so the sheet stays rectangular.
-
Named columns. Row 1 of every sheet is a bold header; the full column list is in the user manual.
Configuration
There are no options. write_xlsx takes the document and the output path;
the sheet layout is fixed so that downstream tooling can rely on it.
| Argument | Type | Effect |
|---|---|---|
document |
camt053.models.ParsedDocument |
The statement or report to write |
path |
str or pathlib.Path |
Where to write the .xlsx file |
Examples
examples/01_minimal_write.py: parse a camt.053 XML string and write it to Excel.examples/02_filter_reversals.py: build aParsedDocumentin code and read back the Reversals sheet.
Both run in CI on every pull request.
When not to use camt053-writer-xlsx
- You need a custom sheet layout. The four sheets and their columns are fixed by design; fork the writer, or post-process the workbook.
- You need
.xls(the legacy binary format).openpyxlwrites.xlsxonly. - You need encrypted or signed output. Encrypt the workbook downstream,
for example with
msoffcrypto-tool. - You want to read Excel back into camt.053. This package only writes.
- You need typed numeric and date cells. Amounts and dates are written as the strings the camt053 model holds, so nothing is rounded on the way in; convert them in the workbook if you need arithmetic.
- Memory is tight and statements are large. The workbook is built in memory; size the process from the row count, not the file size (benchmarks).
Development
git clone https://github.com/sebastienrousseau/camt053-writer-xlsx
cd camt053-writer-xlsx
python -m venv .venv && . .venv/bin/activate
pip install --require-hashes -r requirements/test.txt -r requirements/lint.txt
pip install --no-deps -e .
make check
make check runs ruff, reuse lint, mypy in strict mode, the complexity
ceilings, the version-agreement check, pytest with a 100% line and branch
coverage gate, interrogate at 100% docstring coverage, the benchmark and the
examples. CI also runs the dependency audit (pip-audit), Atheris fuzzing
of write_xlsx (two minutes per change, thirty weekly), CodeQL, OpenSSF
Scorecard, the DCO check and a daily Suite Consistency check against PyPI.
See DEVELOPMENT.md and CONTRIBUTING.md.
Security
The writer takes an already-parsed ParsedDocument, not raw XML, so the XXE
and entity-expansion surface lives in the camt053 core. It opens no
sockets and writes only to the path it is given; validating that path is the
caller's job. Releases are published from a signed tag through PyPI Trusted
Publishing, with SLSA build provenance, sigstore signatures and a CycloneDX
SBOM, and every dependency CI installs is hash-pinned and audited with
pip-audit.
Report vulnerabilities according to SECURITY.md.
Documentation
User manual · API reference · Developer guide · Family map · Changelog · Toolchain policy
Stability guarantees
The project is pre-1.0 and versions advance in 0.0.1 steps, in lockstep
with the camt053 suite. The breaking axis is write_xlsx's signature and the
workbook it writes for a given document: renaming, reordering or removing a
sheet or column, or changing what a cell holds, is breaking even when no
signature moves, and the changelog calls it out. The Python floor moves only
as described in the toolchain policy.
License
This project is dual-licensed under either:
- Apache License, Version 2.0 (
LICENSE-APACHEor https://www.apache.org/licenses/LICENSE-2.0) - MIT License (
LICENSE-MITor https://opensource.org/licenses/MIT)
at your option. Dependencies keep their own licences.
Metadata
Release files for camt053-writer-xlsx 0.0.26
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| camt053_writer_xlsx-0.0.26.tar.gz | 330.8 kB | With provenance | Details for camt053_writer_xlsx-0.0.26.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| camt053_writer_xlsx-0.0.26-py3-none-any.whl | Python 3 | none | any | Details for camt053_writer_xlsx-0.0.26-py3-none-any.whl |
Total release size: 346.0 kB
Release files / camt053_writer_xlsx-0.0.26.tar.gz
| Download URL | camt053_writer_xlsx-0.0.26.tar.gz |
|---|---|
| Size | 330.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd0fcc73342b3424941f6e757f9557f9ec66ad3ad52b1b11132747a42450c589
|
|
BLAKE2b-256 checksum How to use checksums |
1d7ae79c87f193fc83c7a8dc017ad72075a04c6bb8d9456fa68dcca0abef4332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logRelease files / camt053_writer_xlsx-0.0.26-py3-none-any.whl
| Download URL | camt053_writer_xlsx-0.0.26-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c207a1cfc2d173a0f953bff8c395a64dc95869877c45516eab67e2323fd55df6
|
|
BLAKE2b-256 checksum How to use checksums |
9030e69b6188ac15740ac50e7aae356264449d589b9559a756379e0a01c1d8d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logSecurity for camt053-writer-xlsx 0.0.26
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for camt053_writer_xlsx-0.0.26.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.