exceljs: TypeError: Cannot read property 'sheets' of undefined
I got this error when I tested the parsing process from an excel file. Hope someone can help me with this
TypeError: Cannot read property 'sheets' of undefined
at _callee10$ (/Users/tvi/Documents/BCM projects/cvd-genomics/node_modules/exceljs/dist/es5/xlsx/xlsx.js:553:43)
at tryCatch (/Users/tvi/Documents/BCM projects/cvd-genomics/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/Users/tvi/Documents/BCM projects/cvd-genomics/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/Users/tvi/Documents/BCM projects/cvd-genomics/node_modules/regenerator-runtime/runtime.js:117:21)
at asyncGeneratorStep (/Users/tvi/Documents/BCM projects/cvd-genomics/node_modules/exceljs/dist/es5/xlsx/xlsx.js:3:103)
at _next (/Users/tvi/Documents/BCM projects/cvd-genomics/node_modules/exceljs/dist/es5/xlsx/xlsx.js:5:194)
at <anonymous>
Excel File: TEST.xlsx
exceljs version: 2.0.1
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 34 (3 by maintainers)
Not sure of the exact root cause, but opening the file in Excel and saving it again works.
Hi Everyone,
I reproduced this issue: Failed: Cannot read property ‘sheets’ of undefined
Configuration settings:
node - v: 14.16.0
“exceljs”: “^4.2.1”
test File: testFile.xlsx
Code:
Error raises during next line execution: await workbook.xlsx.readFile(pageComparisonXLSXFilePath);
Could you help me?
Regards, Sergei.
I’ve fixed this as a part of this PR: https://github.com/exceljs/exceljs/pull/1570
@Privatecoder Thought that would be the case - I saw the same issue on 12 and 13, I make sure to just use 15 because streams had a few odd bugs in those versions. Even 14 had some weird issues.
@Siemienik thanks for your reply, but the error happens before we can get the worksheet. It’s more related to workbook than worksheet.
Lib code that throws the error: