Skip to main content

Excel (.xlsx) writer for camt053-parsed ISO 20022 bank statements.

Project description

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.1 — 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

camt053_writer_xlsx-0.0.8.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

camt053_writer_xlsx-0.0.8-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

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

Hashes for camt053_writer_xlsx-0.0.8.tar.gz
Algorithm Hash digest
SHA256 f40212e9414a59eb2a0305958297ac8d2924d5b148317c4cac8121384504e15e
MD5 e7be9fcaf1e5fc5431146314ade6d33a
BLAKE2b-256 6abd2f38cde5150be2556d50d5b5df8e681984a9ffda73ea9ae4a3a4f5fd9014

See more details on using hashes here.

Provenance

The following attestation bundles were made for camt053_writer_xlsx-0.0.8.tar.gz:

Publisher: release.yml on sebastienrousseau/camt053-writer-xlsx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file camt053_writer_xlsx-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for camt053_writer_xlsx-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f8704bd77aa7ec5953172962b615ae24a0f85adde0d49a8f52101be7a92faf5a
MD5 b197cf970c5030e730e27714950f8fd9
BLAKE2b-256 0d38f476eb4af26f74a03f27534b3fea353484c05f02165042cb1ed980178e09

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page