ExcelAlchemy
Schema-driven Python library for typed Excel import/export workflows with Pydantic and locale-aware workbooks.
ExcelAlchemy turns Pydantic models into workbook contracts:
- generate Excel templates from code
- validate uploaded workbooks
- map failures back to rows and cells
- return result workbooks and API-friendly error payloads
- keep workbook IO pluggable through
ExcelStorage
The current stable release is ExcelAlchemy 3.0. It uses ordinary Python
annotations plus explicit ExcelColumn(...) metadata. Old 2.x field factories,
compatibility imports, legacy config fields, and facade aliases are not current
API.
GitHub Repository · Full README · Getting Started · Examples · Public API · Migration Notes
Screenshots
Template
Import Result
Install
pip install ExcelAlchemy
Optional Minio-compatible storage support:
pip install "ExcelAlchemy[minio]"
Quick Example
from typing import Annotated
from pydantic import BaseModel, Field
from excelalchemy import EmailCodec, ExcelAlchemy, ExcelColumn, ImporterConfig
class EmployeeImport(BaseModel):
name: Annotated[str, ExcelColumn(label='Name', order=1)]
email: Annotated[
str,
Field(min_length=8),
ExcelColumn(
label='Email',
codec=EmailCodec(),
order=2,
hint='Use your work email',
example_value='alice@company.com',
),
]
alchemy = ExcelAlchemy(ImporterConfig(EmployeeImport, locale='en'))
template = alchemy.download_template_artifact(filename='employees-template.xlsx')
excel_bytes = template.as_bytes()
Import Workflow
The shortest import path is:
template -> preflight -> import -> remediation -> delivery
Minimal backend sketch:
from excelalchemy.results import ImportLifecycleEvent, build_frontend_remediation_payload
events: list[ImportLifecycleEvent] = []
preflight = alchemy.preflight_import('employees.xlsx')
if preflight.is_valid:
result = await alchemy.import_data(
'employees.xlsx',
'employees-result.xlsx',
on_event=events.append,
)
payload = {
'result': result.to_api_payload(),
'cell_errors': alchemy.cell_error_map.to_api_payload(),
'row_errors': alchemy.row_error_map.to_api_payload(),
'remediation': build_frontend_remediation_payload(
result=result,
cell_error_map=alchemy.cell_error_map,
row_error_map=alchemy.row_error_map,
),
}
Why ExcelAlchemy
- Pydantic v2-based schema extraction and validation
Annotated[..., ExcelColumn(...)]declaration style- workbook comments and result workbooks in
zh-CN,en, orja - pluggable storage instead of a hard-coded backend
openpyxl-based runtime path without pandas- contract tests, Ruff, and Pyright in the development workflow
Learn More
Metadata
Release files for ExcelAlchemy 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| excelalchemy-3.0.0.tar.gz | 74.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| excelalchemy-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 176.4 kB
Release files / excelalchemy-3.0.0.tar.gz
| Download URL | excelalchemy-3.0.0.tar.gz |
|---|---|
| Size | 74.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2860cd33113fb89691e45376472d2b6596485bfba9f652f44c83c27f2b0537e7
|
|
BLAKE2b-256 checksum How to use checksums |
260e21e67366f1a9c36962801448be937286e9ac93a028dc92c679e2c121ee62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 23, 2026.
Transparency logRelease files / excelalchemy-3.0.0-py3-none-any.whl
| Download URL | excelalchemy-3.0.0-py3-none-any.whl |
|---|---|
| Size | 102.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be816b5b9f8705e583aa11c7eb33ac2a18ce15e471a9bda462e869ebc06876b2
|
|
BLAKE2b-256 checksum How to use checksums |
9d9903c663bea68be5bdeb6bc6364075866bb34dd2aa635b6f2ee243ef0632fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 23, 2026.
Transparency log