sheetStubs causes "unrecognized type stub" in sheet_to_json #382
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#382
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Issue: when I set option sheetStubs to true while running XLSX.readFile on a xlsx file, I'll get "unrecognized type stub" if I run XLSX.utils.sheet_to_json on the result.
Edit: Forgot to mention #333 also mentions this issue and there's a pull request against it (#354), but I believe my comments below address the root cause, and the potential fix below may better prevent further downline issues.
Expected behavior: I would think the xlsx package would correctly use the sheetStubs option while parsing a file with empty cells.
Steps to reproduce:
Potential fix:
In xlsx.js on lines 7479 & 7480, it sets p.t = "stub" if opts.sheetStubs is present. However, slightly further down in the switch statement beginning on line 7486 where it's checking for different p.t types, there is nothing matching a p.t value of "stub". I believe case 'str' (7494) is what it should slot into, as case str assigns "s" to p.t and correctly checks for an empty value, assigning an empty string to p.v if so. I tried setting p.t = "str" on line 7480 and it seems to work. Not sure if this is the correct fix though.
+1 for needing fix