Skip to main content
| XlsxLoader.load(path) |

| | | -> LoaderResult | +----------+---------------+ +----------+---------------+ | | | extension dispatch (.xlsx) | v v +------+-------+ +------+-------+ | pain001 | | openpyxl | | registry | | read_only | +--------------+ +--------------+


pain001 v0.0.54 ships a formal plugin contract; this package
exposes one Python class that satisfies it. Wired into pain001 via
a single line in this package's `pyproject.toml`:

```toml
[project.entry-points."pain001.loaders"]
xlsx = "pain001_loader_xlsx.loader:XlsxLoader"

That is all the integration there is. pain001 discovers the entry point at process start via importlib.metadata.entry_points and dispatches by extension. There is no global state, no central registry to update, nothing to subclass.


Layout

The first sheet of the workbook is read. Row 1 is the header (column names become dict keys); rows 2..N are the data records. Cells are read with openpyxl's data_only=True so formulas resolve to their cached last-saved value — what the user sees in Excel is what pain001 gets.

The IBAN guard, explained

Excel's "General" cell format silently coerces a numeric-looking string like 0023012345... into the integer 23012345..., dropping the leading zeros. This is a known data-corruption mode in SAP / Oracle / Workday exports. To protect against it the loader refuses any row whose debtor_account_IBAN / creditor_account_IBAN / charge_account_IBAN cell is typed as a number, and tells the user to re-type the column as Text:

workbook 'payments.xlsx' column 'debtor_account_IBAN' contains
a numeric value (89370400440532013000) where an IBAN string is
expected. Excel's 'General' cell format silently strips leading
zeros from IBANs; re-type the column as 'Text' (in Excel: select
the column, Format Cells -> Number -> Text) and re-export.

Caught early, the warning saves the user from wiring an IBAN with a missing digit to a bank.


Using the loader from Python

For Lambdas, ETL pipelines, or just inspecting an Excel file's records before generation, you can use XlsxLoader directly without going through pain001's dispatch:

from pain001_loader_xlsx import XlsxLoader

loader = XlsxLoader()
result = loader.load("payments.xlsx")

print(result.source_hint)  # -> "payments.xlsx"
print(len(result.rows))  # -> 42
print(result.rows[0]["id"])  # -> "MSG-0001"

Streaming variant for batches that don't fit in memory:

for chunk in loader.load_streaming("big-payments.xlsx", chunk_size=1000):
    process(chunk.rows)

The runnable version of this snippet (and a couple of others) lives in examples/.


The pain001 suite

pain001-loader-xlsx is part of a set of independently installable packages built around the pain001 library — pick whichever ones your stack needs:

Package Role
pain001 Core library + CLI + FastAPI REST API
pain001-mcp Model Context Protocol server (for AI agents)
pain001-lsp Language Server Protocol server (for editors)
pain001-loader-xlsx Excel loader plugin (this package)
flowchart LR
    A["payments.xlsx"] -->|extension dispatch| B["pain001-loader-xlsx"]
    B -->|LoaderResult| C["pain001"]
    C -->|render + XSD validate| D["ISO 20022 pain.001 XML"]

When not to use pain001-loader-xlsx

  • You can export CSV cleanly. A .csv round-trip skips an entire transitive dependency tree (openpyxl + its handful of deps). pain001's built-in CSV loader is preferred when you have the choice.
  • You need multi-sheet support. The first sheet wins; cross-sheet payment batches need to be consolidated first.
  • You need .xls (legacy binary format). Out of scope. Convert to .xlsx first, or use a different loader.
  • Your data isn't payment-record-shaped. This loader is a thin pain001 input adapter, not a general-purpose Excel reader.

Development

pain001-loader-xlsx uses standard Python tooling — no Poetry, just pip + pyproject.toml.

git clone https://github.com/sebastienrousseau/pain001-loader-xlsx.git
cd pain001-loader-xlsx
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

Quality gates (kept in lockstep with CI):

Target What it runs
pytest Full test suite
pytest --cov=pain001_loader_xlsx --cov-branch --cov-fail-under=100 100% line + branch coverage gate
interrogate -c pyproject.toml pain001_loader_xlsx 100% docstring coverage gate
ruff check pain001_loader_xlsx tests Lint
ruff format --check pain001_loader_xlsx tests Format
mypy pain001_loader_xlsx Type check

Current state (v0.0.54): 12 tests passing, 100% line + branch coverage, ruff + mypy clean, interrogate 100% docstring coverage.


Security

  • No filesystem writes. The loader reads from an Excel file path and yields plain dicts; it does not create, modify, or delete files.
  • No code execution. openpyxl's read_only=True mode does not evaluate macros (Excel VBA is not executed). data_only=True returns the cached last-saved value of formulas — no formula engine runs.
  • IBAN safety: the loader refuses any row whose IBAN cells are numeric (see Layout), avoiding the "Excel silently dropped a leading zero" data-corruption mode.
  • Dependencies are pinned via pyproject.toml (openpyxl >= 3.1, < 4) and audited by GitHub's Dependabot.

To report a vulnerability, please use GitHub private vulnerability reporting rather than a public issue.


Documentation


Contributing

Contributions are welcome — see the contributing guide (or the upstream pain001 contributing guide if a per-repo one has not landed yet). Thanks to all the contributors who have helped build pain001-loader-xlsx.


License

Licensed under the Apache License, Version 2.0. Built on openpyxl and the pain001 plugin contract.

Any contribution submitted for inclusion shall be licensed as above, without additional terms.


pain001.com · PyPI · GitHub

Release files for pain001-loader-xlsx 0.0.69

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

Source distribution (sdist)

Source distribution for pain001-loader-xlsx 0.0.69
File Size Uploaded
pain001_loader_xlsx-0.0.69.tar.gz 53.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pain001-loader-xlsx 0.0.69
File Interpreter ABI Platform
pain001_loader_xlsx-0.0.69-py3-none-any.whl Python 3 none any Details

Total release size: 71.7 kB

Release files / pain001_loader_xlsx-0.0.69.tar.gz

Download URL pain001_loader_xlsx-0.0.69.tar.gz
Size 53.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8296b01fee8b4304adc4d535a70c91055979ca9ef14fceaaae0b36fa21abe1f6
BLAKE2b-256 checksum
How to use checksums
db996f55d6c5ba5d65c50511f1955855bbcd7ec74d69f3fcc937de677ecdf2ee
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 Sep 12, 2026.

Transparency log

Release files / pain001_loader_xlsx-0.0.69-py3-none-any.whl

Download URL pain001_loader_xlsx-0.0.69-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39b562ccef260ac60dd31283e6a5621d59ea4b36c0511ec1fe39fdf5c6014b61
BLAKE2b-256 checksum
How to use checksums
2fa49773eb19254a3be229aa3e84c728170a6b6c66437c20ca399e9683f7d31f
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 Sep 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.0.71

2 release files

0.0.70

2 release files

This release

0.0.69 This release

2 release files

0.0.68

2 release files

0.0.67

2 release files

0.0.66

2 release files

0.0.65

2 release files

0.0.63

2 release files

0.0.62

2 release files

0.0.61

2 release files

0.0.54

2 release files

0.0.53

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