Skip to main content

camt053-writer-xlsx: Excel writer for parsed camt.053 statements

camt053-writer-xlsx logo

PyPI Version Python Versions License Tests Quality

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.14 — single write_xlsx(document, path) function, 100% line + branch coverage, 100% docstring coverage.

Contents

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 agents
  • camt053-lsp — the Language Server Protocol server for editors
  • camt053-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/:

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). openpyxl writes .xlsx only; convert downstream if you must.
  • You need encrypted output. Out of scope; encrypt the produced .xlsx downstream with a tool like msoffcrypto-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

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.

Metadata

Release files for camt053-writer-xlsx 0.0.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for camt053-writer-xlsx 0.0.20
File Size Uploaded
camt053_writer_xlsx-0.0.20.tar.gz 40.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for camt053-writer-xlsx 0.0.20
File Interpreter ABI Platform
camt053_writer_xlsx-0.0.20-py3-none-any.whl Python 3 none any Details

Total release size: 52.8 kB

Release files / camt053_writer_xlsx-0.0.20.tar.gz

Download URL camt053_writer_xlsx-0.0.20.tar.gz
Size 40.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f394ea8620a1e51af4877df2dc7b1cd31b3bd17b572f47797deb25fe87466540
BLAKE2b-256 checksum
How to use checksums
6ef95c05d54e159df40b175a73579283c2659d934c3e7bdc448ac08467f387a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 29, 2026.

Transparency log

Release files / camt053_writer_xlsx-0.0.20-py3-none-any.whl

Download URL camt053_writer_xlsx-0.0.20-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
685883c11f58cbae8718c6c21d53943d56b311831594c7692eddf641c82653c5
BLAKE2b-256 checksum
How to use checksums
dd7a06fc123aaa096a2ed67658723ef9753f7b5850225634438b064bc628a727
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.20 This release

2 release files

0.0.16

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page