Skip to content

fix(ocr): tolerate legacy showZeroes sheet views in XLSX conversion - #2403

Open
Lazizbek Ergashev (lazerg) wants to merge 2 commits into
microsoft:mainfrom
lazerg:fix/issue-2400-ocr-xlsx-showzeroes
Open

fix(ocr): tolerate legacy showZeroes sheet views in XLSX conversion#2403
Lazizbek Ergashev (lazerg) wants to merge 2 commits into
microsoft:mainfrom
lazerg:fix/issue-2400-ocr-xlsx-showzeroes

Conversation

@lazerg

@lazerg Lazizbek Ergashev (lazerg) commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #2400.

XlsxConverterWithOCR calls load_workbook() and pandas.read_excel() directly, so it never gets the showZeroes -> showZeros worksheet repair that #2064 added to the core XLSX converter. Workbooks that still carry the legacy attribute raise TypeError: SheetView.__init__() got an unexpected keyword argument 'showZeroes' as soon as the OCR plugin is enabled, even though plain MarkItDown converts them fine.

This reuses the core repair helpers instead of duplicating them: the standard path now goes through _read_xlsx_sheets, and the OCR path loads the workbook through a small _load_xlsx_workbook helper that repairs and retries on that specific error, returning the repaired stream so the per-sheet read_excel() calls read it too.

One packaging note: those helpers landed in #2064, after the last version bump, so the first markitdown that has them is 0.1.8b1. markitdown-ocr declared markitdown>=0.1.0, which would give an ImportError at plugin import time against a released markitdown, so the floor is raised here. Happy to change the pin if you would rather sequence the releases differently.

Tests: two regression tests in packages/markitdown-ocr/tests/test_xlsx_converter.py build a copy of xlsx_image_start.xlsx with the legacy attribute, covering the OCR path and the no-OCR path. They fail before the fix and pass after, and the OCR one asserts the output matches the untouched workbook, so the repair keeps the embedded images.

Move the repair-and-retry into a _load_xlsx_workbook helper so the OCR path
mirrors the core converter, and raise the markitdown floor to the version that
provides the repair helpers.
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.

OCR XLSX converter still fails on legacy showZeroes sheet views

1 participant