Skip to content

fix(xlsx): tolerate legacy showZeroes sheet views - #2064

Merged
afourney merged 3 commits into
microsoft:mainfrom
he-yufeng:fix/xlsx-sheetview-showzeroes
Sep 2, 2026
Merged

fix(xlsx): tolerate legacy showZeroes sheet views#2064
afourney merged 3 commits into
microsoft:mainfrom
he-yufeng:fix/xlsx-sheetview-showzeroes

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Fixes #2063.

Some XLSX files still contain the worksheet view attribute name showZeroes. openpyxl 3.1+ expects showZeros, so loading those files raises a TypeError before MarkItDown can read the workbook.

This keeps the normal pandas/openpyxl path unchanged. If that path fails with the known showZeroes TypeError, MarkItDown rewrites worksheet XML entries in memory from showZeroes to showZeros and retries the read. The fallback is scoped to worksheet XML files and only runs for that specific compatibility error.

Validation:

  • .venv\Scripts\python.exe -m pytest packages\markitdown\tests\test_module_misc.py -q -k "xlsx_legacy_show_zeroes"
  • .venv\Scripts\python.exe -m pytest packages\markitdown\tests\test_module_vectors.py::test_convert_local -q
  • .venv\Scripts\python.exe -m py_compile packages\markitdown\src\markitdown\converters_xlsx_converter.py packages\markitdown\tests\test_module_misc.py
  • .venv\Scripts\python.exe -m ruff check packages\markitdown\src\markitdown\converters_xlsx_converter.py packages\markitdown\tests\test_module_misc.py
  • git diff --check

@he-yufeng

Copy link
Copy Markdown
Contributor Author

Friendly ping for maintainer review. The CLA check is green, and the current patch is limited to the openpyxl showZeroes compatibility fallback plus a regression test. Please let me know if you want the compatibility path shaped differently.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The unrestricted byte replacement can silently modify inline worksheet cell values.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds XLSX compatibility handling for legacy showZeroes worksheet attributes.

Changes:

  • Retries XLSX parsing after an in-memory worksheet XML repair.
  • Adds an end-to-end regression test for legacy workbooks.
File summaries
File Description
_xlsx_converter.py Implements compatibility fallback and retry.
test_module_misc.py Tests legacy workbook conversion.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/markitdown/src/markitdown/converters/_xlsx_converter.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The fallback is narrowly scoped, preserves normal behavior, and has appropriate regression coverage.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@afourney
afourney merged commit 0f26ef9 into microsoft:main Sep 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XLSX Conversion Fails: SheetView parameter 'showZeroes' incompatible with openpyxl 3.1.0+

3 participants