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.16

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.16
File Size Uploaded
camt053_writer_xlsx-0.0.16.tar.gz 23.7 kB Details

Built distribution (wheel)

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

Total release size: 35.1 kB

Release files / camt053_writer_xlsx-0.0.16.tar.gz

Download URL camt053_writer_xlsx-0.0.16.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
21ed97760da4e862acb885d67aeea0fa338b0aae80d46aff4e188c59519bc082
BLAKE2b-256 checksum
How to use checksums
904900a4100d0e0ed583108e12883ea7f849ee15a11eaeed732df8900fa4d61a
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 21, 2026.

Transparency log

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

Download URL camt053_writer_xlsx-0.0.16-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48d2e61f51685a829411d8fc7e119e538eaf534b43a2900653a65d2bb4faa9ca
BLAKE2b-256 checksum
How to use checksums
ca2966ad473f4119ea6f2944c949009e6a52b9dc2f4f1f4ed68d27b2ec745b54
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 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.0.20

2 release files

This release

0.0.16 This release

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