Skip to content

XLSX to Markdown conversion to work with XLSX files with empty Sheets.#13

Merged
dead8309 merged 1 commit intodead8309:mainfrom
tiblu:main
Jan 26, 2026
Merged

XLSX to Markdown conversion to work with XLSX files with empty Sheets.#13
dead8309 merged 1 commit intodead8309:mainfrom
tiblu:main

Conversation

@tiblu
Copy link
Contributor

@tiblu tiblu commented Jan 26, 2026

XLSX to Markdown conversion to work with XLSX files with empty Sheets.

The problem

IF you tried to convert an XLSX file containing empty Sheets, following error would occur:

console.error
    TypeError: Cannot read properties of undefined (reading 'indexOf')
        at decode_range (/home/tiblu/dev/kaiq-api/node_modules/xlsx/xlsx.js:4118:18)
        at Object.sheet_to_html (/home/tiblu/dev/kaiq-api/node_modules/xlsx/xlsx.js:20905:10)
        at XlsxConverter.convert (/home/tiblu/dev/kaiq-api/node_modules/markitdown-ts/dist/index.cjs:715:49)
        at processTicksAndRejections (node:internal/process/task_queues:105:5)
        at MarkItDown._convert (/home/tiblu/dev/kaiq-api/node_modules/markitdown-ts/dist/index.cjs:1149:17)
        at MarkItDown.convert_local (/home/tiblu/dev/kaiq-api/node_modules/markitdown-ts/dist/index.cjs:1136:12)

The fix

Check that ws["!ref"] is defined so that the XLSX library would not fail.
That said, it MAY be right to fix it somehow inside the XLSX library, BUT seeing how many un-merged PR-s the repo has, I abandoned all hope and decided to fix it inside this codebase.

Sidenotes

Thanks for the tool, nice to contribute to a OSS project with easy setup and good test coverage.

@dead8309 dead8309 merged commit f2ee013 into dead8309:main Jan 26, 2026
1 check passed
@tiblu
Copy link
Contributor Author

tiblu commented Jan 26, 2026

Thanks for merge!
Any plans for a release to NPM?
Due to the nature of this project, using it from my own it is not possible to use a link to my Git fork as dependency in package.json.

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.

2 participants