Metadata-Version: 2.4
Name: xlsx-fixer
Version: 0.1.0
Summary: Fix Mac Excel corruption in .xlsx files generated by openpyxl.
Author-email: James Lambert <james@revasser.nyc>
License: MIT
Project-URL: Homepage, https://github.com/revereveal/revasser-operating-system/tree/main/services/xlsx-fixer
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.31.0

# 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
```bash
pip install xlsx-fixer
```

## Usage

### CLI
Run it on any `.xlsx` file generated by `openpyxl`:
```bash
xlsx-fixer path/to/your/file.xlsx
```

### Programmatic API
You can also run it directly inside your Python generation script, immediately after saving:
```python
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)
```
