CSV read Issue: Empty Content Returned When First Column Name Starts with "TABL" #3230
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#3230
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?
When attempting to read a CSV file, if the first column name begins with "TABL", the result of the read operation is an empty content.
Thanks for sharing!
When a file starts with
TABL
, currently the parser attempts to interpret the worksheet as if it were a DIF spreadsheetThis logic is in the core switch statement in the
readSync
function https://git.sheetjs.com/sheetjs/sheetjs/src/branch/master/bits/87_read.js#L102The current implementation only looks at the first 4 bytes and the
DIF
parser does not currently check for errors.The
SYLK
file format starts withID
and there is a special workaround to handle that case. It makes sense to implement a similar workaround here.Currently there is no real DIF error checking, so the simplest workaround is to check if the worksheet is missing a
!ref
property. This exploits a quirk in theaoa_to_sheet
function so we will definitely need to add a test and ensure the logic changes whenaoa_to_sheet
is eventually changed.You can follow the "Contributing" section of the docs then apply the patch. If you would like a pre-patched NodeJS package or browser script, join the SheetJS chat