excel-slim
Excel file optimization with a Rust core and a Python-first API. The default path is lossless and deterministic, with optional lossy media optimization when explicitly enabled.
Highlights
- Python API:
excel_slim.optimize()andexcel_slim.analyze() - CLI mirrors Python options (no subprocess in Python)
- Lossless by default, lossy media is opt-in
- Deterministic output (stable ordering, timestamps)
- Handles
.xlsxand.xlsm(VBA pass-through)
Install
Python (published on PyPI)
pip install excel-slim
Python (from source)
python -m pip install maturin
maturin develop
CLI (from source)
cargo build -p excel-slim-cli --release
./target/release/excel-slim --help
Quick start
Python
import excel_slim
report = excel_slim.optimize(
"input.xlsx",
output="output.xlsx",
profile="safe",
xml=True,
zip=True,
vba="auto",
media="off",
)
info = excel_slim.analyze("input.xlsm")
CLI
excel-slim input.xlsx --report
excel-slim input.xlsm --xml --zip --vba=auto --media=lossless --report=json
Python API
analyze
info = excel_slim.analyze("input.xlsx")
Returns a dict with:
format:xlsx|xlsm|xls|csv|unknownsize_byteshas_vba,has_mediaxml_stats: worksheets, shared strings size, styles sizerecommendations,risks
optimize
report = excel_slim.optimize(
"input.xlsx",
output="output.xlsx",
profile="safe", # safe | balanced | aggressive
xml=True, # XML optimizations
zip=True, # ZIP repack
vba="auto", # auto | off | on
media="off", # off | lossless | lossy
report=True,
report_format="dict", # dict | json_string
)
optimize() returns an OptimizationReport with per-module savings and metadata.
Convenience API
from excel_slim import WorkbookOptimizer
opt = WorkbookOptimizer("input.xlsx")
opt.profile("safe").xml(True).zip(True).media("lossless")
report = opt.optimize("output.xlsx")
Profiles
safe: fast, lossless only. Skips heavy XML passes.balanced: enables style pruning for additional savings.aggressive: enables XML minify and best compression (slowest).
Determinism
- Stable ZIP ordering
- Fixed timestamps
- Consistent compression settings by profile
Safety
- Never executes macros or formulas
- VBA streams are preserved as-is
- Zip entry validation prevents path traversal
Development
Requirements
- Rust 1.70+
- Python 3.8+
- maturin (
python -m pip install maturin)
Build + test
cargo test
python -m pytest
Publish (PyPI)
This uses maturin to build and publish wheels.
maturin build --release
maturin publish --release
Set your token in the environment before publishing:
export MATURIN_PYPI_TOKEN="pypi-..."
Roadmap
See the engineering plan in the project brief for shared strings, styles pruning, VBA compression, media optimization, and XLS support phases.
Release files for excel-slim 0.1.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 | |
|---|---|---|---|
| excel_slim-0.1.0.tar.gz | 22.4 kB | Details |
Built distributions (wheels)
Total release size: 14.0 MB
Release files / excel_slim-0.1.0.tar.gz
| Download URL | excel_slim-0.1.0.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e20744f82056f9abe325161344869b05f6c23a381ad506c0534dc99d54057bb
|
|
BLAKE2b-256 checksum How to use checksums |
5f8c2fa481f512c42c83697f21b10b2683622715ba5b7125e8bc651ef51f7d3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp312-cp312-win_amd64.whl
| Download URL | excel_slim-0.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 813.8 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8d8507d0edc9a77296c873fc889211c8ae538d8680aa7a5668e7b68129b15628
|
|
BLAKE2b-256 checksum How to use checksums |
bd61c36a751ed8f054bed2eba8c59129f1dec2f79999a533a4652490c0343347
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | excel_slim-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
f1b3ca1e717bb9bb9e9fd60b21ab1d4db0a279d079a535907a6d883f9b244f6b
|
|
BLAKE2b-256 checksum How to use checksums |
9afaf359bb814c4269c8c8bc48e48bb38c9f860abc04371e8a9a670e05dfef64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | excel_slim-0.1.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 850.7 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2396f20a87c97eea6ec5d09dcd3e57e4dade99ca4cb5928aa69990d1c9dd62d2
|
|
BLAKE2b-256 checksum How to use checksums |
bd52ed6cff02675210e8933ebb6d90c2823d3bea2ed74cbc3712bd9b32a45922
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp311-cp311-win_amd64.whl
| Download URL | excel_slim-0.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 813.0 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e0f0d0d2d959ab26b9f57cc60c2d87a999295b283165dc095800e5eddb3ef30a
|
|
BLAKE2b-256 checksum How to use checksums |
8fbf7086c3d6f5eb21559c8177a6998050ba40ff36cb36a8e1615abcb9d411e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | excel_slim-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
0676ad90585c92b2ef9d38b1c645d1cb768b9b4862ee33a659d219684e18ba26
|
|
BLAKE2b-256 checksum How to use checksums |
922139fd252f5350213a955d16eba63ff0248c9167b42aa93f41ee4bb8e5010c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | excel_slim-0.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 850.5 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
18fe332a379db3234a2459635f6613015afb818187242bf7363657f5bd5b2410
|
|
BLAKE2b-256 checksum How to use checksums |
36fe097679c452d7f985159daab219fb69d2ddb3537af9dceeffdc8ad410c446
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp310-cp310-win_amd64.whl
| Download URL | excel_slim-0.1.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 813.1 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d12a4722979a6420e8d55810c81d5942462eb8a152ea5548077b588c201ea5a8
|
|
BLAKE2b-256 checksum How to use checksums |
4014839a57dbf1d93fb06bdd69d153ab012427061f8fbd91e859f77795ff3b63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
| Download URL | excel_slim-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
fae051c5a63b78384e12830795071273977e082c166826c70883353eedc8b18a
|
|
BLAKE2b-256 checksum How to use checksums |
af44852d668665edf5efb09fc8eb7085bf67b26c0132b82621a7d7272f5d0ff9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | excel_slim-0.1.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 850.6 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
67554052883df52c24f6d68acc637a807f57ad998a65870e70bd3e3af6d266a6
|
|
BLAKE2b-256 checksum How to use checksums |
8309c23ddad27a3afca1b3678907fa990ca24a1166613e67fdff244a60ab4572
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp39-cp39-win_amd64.whl
| Download URL | excel_slim-0.1.0-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 813.1 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
39b1f25227520f7f4fcd6f6570a52910ae1db0627b4f13db24e0dfdaa47c836b
|
|
BLAKE2b-256 checksum How to use checksums |
d1c82407e4a826178ee829ba2a6d2054f2b8943320ed01ba0c250c6a93e640ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl
| Download URL | excel_slim-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
f0805ccae040071fd429edf88f558b031434897521a1631b0495b58b0253e18c
|
|
BLAKE2b-256 checksum How to use checksums |
82b63c1c9a3b14230bf6f4265a1904a329c195b343e2484dde93a384d9c8956d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | excel_slim-0.1.0-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 850.6 kB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c340ca5045039da488b8a9241936164cb3781ce8b5f22539bf94bc3e8dc2b570
|
|
BLAKE2b-256 checksum How to use checksums |
4d437d7683928e2b9e3a02d1fd847cc0b6d3b8d2fce06d00fad52f4222b13d0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp38-cp38-win_amd64.whl
| Download URL | excel_slim-0.1.0-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 812.8 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e8c9324ccd09ecdc95bbf8135f80beae67f09ad37b6f924705eeeea5dd6c82c6
|
|
BLAKE2b-256 checksum How to use checksums |
1561255136e6d75929b231770e1aa2b4efaff53e1a8f181a63cf68af522c90c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl
| Download URL | excel_slim-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.8 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
5a18c68c72e7932c03042d5e049975eaed20bb6bad37a0f28330b3211ed02b13
|
|
BLAKE2b-256 checksum How to use checksums |
d53565606031917b7bf1a47b13e3c07ec40cd2b5f2f2010bb45496bf41b8b9db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / excel_slim-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
| Download URL | excel_slim-0.1.0-cp38-cp38-macosx_11_0_arm64.whl |
|---|---|
| Size | 850.4 kB |
| Tags | CPython 3.8 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0a00ab1f5d6b252ca06531e9b9e04fa8e48b91ff8fa54f24fe4719b5ba736fef
|
|
BLAKE2b-256 checksum How to use checksums |
bbd12abb662917164d05a8cfb711ebb327837e21f8ce70b1f587e5d233fbf0a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|