TypeError: Cannot read properties of undefined (reading 'utils') at read_utf16 #2898
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#2898
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
I'm using
xlsx
version 0.18.5.My application can read all CSVs except this one, and I can't figure out what's special about it. I received a CSV similar to this one from a customer who is using my application, and I was able to simplify it down to the current state and still reproduce the isse. I'm wondering if there's some kind of invalid header on the CSV, but I'm not sure how to check that.
This CSV causes XLSX to throw the error
TypeError: Cannot read properties of undefined (reading 'utils')
.I'm using react, and importing sheetjs like this:
and here's how I'm using it:
Here's the error stack:
I think the error is coming from this line:
https://github.com/SheetJS/sheetjs/blob/master/bits/87_read.js#L53
Thanks for the report! So we can reproduce locally, are you loading the encoding support as described in https://docs.sheetjs.com/docs/getting-started/installation/frameworks#encoding-support ? (in general, forcing UTF8 support should not require the codepage encoding library)
Hmm, no, I didn't see that section in the docs, so I'm just loading in
xlsx
as described in my post.I can try loading in the full codepage encoding library and see if that resolves the issue.
We'll take a closer look later today, but that specific error suggests that the internal codepage instance is defined but not shaped as expected. It is loaded by default when using CommonJS (nodejs require) but not loaded when using the ESM build.
I confirmed that adding
Resolved the issue with this particular CSV. Thanks for the pointer!