Fix Mac Excel corruption in .xlsx files generated by openpyxl.
Project description
xlsx-fixer
A lightweight utility to fix Mac Excel corruption issues caused by openpyxl.
The Problem
When openpyxl writes strings, it hardcodes them as inlineStr instead of using a Shared String Table (SST). Mac Excel (16.x+) often trips over these inline strings, triggering the infamous "We found a problem with some content" recovery dialog on every open.
The Solution
xlsx-fixer is a zero-dependency ZIP post-processor. It reads an openpyxl-generated .xlsx file, extracts all inline strings, builds a deduplicated Shared String Table (sharedStrings.xml), and rewrites the cell references to match the OOXML spec correctly.
Installation
pip install xlsx-fixer
Usage
CLI
Run it on any .xlsx file generated by openpyxl:
xlsx-fixer path/to/your/file.xlsx
Programmatic API
You can also run it directly inside your Python generation script, immediately after saving:
from openpyxl import Workbook
from xlsx_fixer import convert_inline_to_shared_strings
wb = Workbook()
ws = wb.active
ws['A1'] = "Hello World"
output_path = "output.xlsx"
wb.save(output_path)
# Run the post-processor to fix Mac Excel compat
convert_inline_to_shared_strings(output_path)
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-0.1.0.tar.gz.
File metadata
- Download URL: xlsx_fixer-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0e0deaf88af2df55bfbb5cc9c57cd42c0f855e4c2538094370bff4aa092d9bc
|
|
| MD5 |
b8b46b8523dc57f8cd975b1757d8911e
|
|
| BLAKE2b-256 |
54b18410dae3f1e3d39472ab7be2dfb485d61296a027e551165da8af5ebbd60c
|
File details
Details for the file xlsx_fixer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xlsx_fixer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 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 |
ddab9b6a93333e8011cd1721609ed137b98fe18706b04455530eeec662a58bbc
|
|
| MD5 |
7212b758df30d9ac0ac836d7627144e6
|
|
| BLAKE2b-256 |
4cfedad44b99915d52427e96d0d24dfcbd84b418047a226b0cac77b2293ec9ab
|