Schema-driven Python library for typed Excel import/export workflows with Pydantic and locale-aware workbooks.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file excelalchemy-3.0.0.tar.gz.
File metadata
- Download URL: excelalchemy-3.0.0.tar.gz
- Upload date:
- Size: 74.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2860cd33113fb89691e45376472d2b6596485bfba9f652f44c83c27f2b0537e7
|
|
| MD5 |
0f6776970289d972cf59b1ba4a6badc8
|
|
| BLAKE2b-256 |
260e21e67366f1a9c36962801448be937286e9ac93a028dc92c679e2c121ee62
|
Provenance
The following attestation bundles were made for excelalchemy-3.0.0.tar.gz:
Publisher:
python-publish.yml on RayCarterLab/ExcelAlchemy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
excelalchemy-3.0.0.tar.gz -
Subject digest:
2860cd33113fb89691e45376472d2b6596485bfba9f652f44c83c27f2b0537e7 - Sigstore transparency entry: 1924358123
- Sigstore integration time:
-
Permalink:
RayCarterLab/ExcelAlchemy@784bb1b21bd0f6fbeffbeaae2249a6fe28ed4002 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/RayCarterLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@784bb1b21bd0f6fbeffbeaae2249a6fe28ed4002 -
Trigger Event:
release
-
Statement type:
File details
Details for the file excelalchemy-3.0.0-py3-none-any.whl.
File metadata
- Download URL: excelalchemy-3.0.0-py3-none-any.whl
- Upload date:
- Size: 102.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be816b5b9f8705e583aa11c7eb33ac2a18ce15e471a9bda462e869ebc06876b2
|
|
| MD5 |
369a03545eb892e60bc12f959b2529ba
|
|
| BLAKE2b-256 |
9d9903c663bea68be5bdeb6bc6364075866bb34dd2aa635b6f2ee243ef0632fe
|
Provenance
The following attestation bundles were made for excelalchemy-3.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on RayCarterLab/ExcelAlchemy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
excelalchemy-3.0.0-py3-none-any.whl -
Subject digest:
be816b5b9f8705e583aa11c7eb33ac2a18ce15e471a9bda462e869ebc06876b2 - Sigstore transparency entry: 1924358241
- Sigstore integration time:
-
Permalink:
RayCarterLab/ExcelAlchemy@784bb1b21bd0f6fbeffbeaae2249a6fe28ed4002 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/RayCarterLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@784bb1b21bd0f6fbeffbeaae2249a6fe28ed4002 -
Trigger Event:
release
-
Statement type: