Fix Mac Excel corruption in openpyxl-generated .xlsx files
Project description
xlsx-fixer
A zero-dependency delivery-assurance layer for Python data pipelines.
Stop delivering "corrupted" Excel files to your clients and executives.
🚨 The 17-Year-Old Bug
If you generate .xlsx files with Python's openpyxl library and open them on a Mac, your stakeholders will see this terrifying warning:
⚠️ "We found a problem with some content in 'report.xlsx'. Do you want us to try to recover as much as we can?"
For a solo developer, this is annoying. For a data engineering team delivering automated reporting to C-suite executives or high-value clients, this completely destroys the professional credibility of the automation pipeline.
Why does this happen?
openpyxl hardcodes inline strings (t="inlineStr") for every text cell. Mac Excel's strict OOXML parser rejects this. The openpyxl maintainer has declined to fix this for 17+ years, calling it a permanent design decision.
How we fix it
xlsx-fixer intercepts the generated file, safely rebuilds the XML to use a proper shared string table (xl/sharedStrings.xml), drops inconsistent calculation states, and strips illegal control characters. One function call. Zero dependencies.
🛠️ The Open Source Tier (Free)
This repository contains the core fix() engine. It is perfect for ad-hoc scripts and individual files.
pip install xlsx-fixer
Usage (Python)
from openpyxl import Workbook
from xlsx_fixer import fix
wb = Workbook()
ws = wb.active
ws["A1"] = "Hello, Mac Excel!"
# 1. Save normally
wb.save("report.xlsx")
# 2. Fix it before sending to the client
fix("report.xlsx")
Usage (CLI)
# Fix a single file in-place
xlsx-fixer fix report.xlsx
# Check a file for corruption patterns without modifying
xlsx-fixer check report.xlsx
🚀 The Enterprise Tier (xlsx-fixer Pro)
For data engineering teams and CI/CD pipelines, we offer xlsx-fixer Pro.
If you are running Airflow, GitHub Actions, or processing hundreds of files, the Open Source version is too slow and requires too much manual code modification. xlsx-fixer Pro is a pre-compiled, un-hackable binary (Linux/Mac/Windows) designed for enterprise scale.
| Feature | xlsx-fixer (Free) |
xlsx-fixer Pro |
|---|---|---|
Single File Fix (fix()) |
✅ | ✅ |
Drop-in Patch (patch_openpyxl()) |
❌ | ✅ |
Multithreaded Batch CLI (batch) |
❌ | ✅ |
| Big Data Safe Mode (OOM prevention) | ❌ | ✅ |
CI Audit Reporting (--report json) |
❌ | ✅ |
| Deployment Format | Source Code | Compiled Native Binary |
⚡ The Drop-In Patch
Don't rewrite 100 legacy scripts. Just call patch_openpyxl() once at the top of your application, and every wb.save() call is automatically fixed in-place before it hits the disk.
💼 Commercial Licenses
| License | Target Audience | Link |
|---|---|---|
| Pipeline License ($299/yr) | Solo Automators / Boutique Agencies | Purchase on Lemon Squeezy |
| Site License ($899/yr) | Enterprise Data Teams (Uncapped) | Purchase on Lemon Squeezy |
Upon purchase, you will immediately receive your License Key and a secure download link for the compiled CI binaries.
🔬 What It Fixes Under The Hood
| # | Issue | Root Cause | Impact |
|---|---|---|---|
| 1 | Inline strings | openpyxl hardcodes t="inlineStr" |
"We found a problem" dialog on every Mac open |
| 2 | fullCalcOnLoad | openpyxl sets fullCalcOnLoad="1" without generating calcChain.xml |
Recovery dialog; formulas show 0 |
| 3 | Stale calcChain.xml | References cells that no longer contain formulas | "Removed Records: Formula" in repair log |
| 4 | Control characters | Illegal XML 1.0 chars (U+0000-U+0008, etc.) in cell values | ST_Xstring validation failures |
License
The free xlsx-fixer engine is licensed under the MIT License. See LICENSE for details.
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
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 xlsx_fixer-1.2.0.tar.gz.
File metadata
- Download URL: xlsx_fixer-1.2.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4754a8e67a9f0d1df6479216926755b6563b233035f7f36887783f93aa27fb7
|
|
| MD5 |
2b254978a47f2c37e88c3f868df8bbad
|
|
| BLAKE2b-256 |
51da7be0fc15eafddf3ff056bcc9fc3f58a6b3477c3f52e648925108ab6e7a01
|
File details
Details for the file xlsx_fixer-1.2.0-py3-none-any.whl.
File metadata
- Download URL: xlsx_fixer-1.2.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bae15568969af8530013750412ca647c2810243f83e54bd165c9450021005b7
|
|
| MD5 |
693d0e969a4a280c2d430e49643b57f9
|
|
| BLAKE2b-256 |
7040c68a4edd7ff44b4631d3ea8c064b05ec8977a475e6b43973a58f87d9ed9e
|