Issue in XLSX.read with CSV data having only one column #1976
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#1976
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?
I came accross this issue while working with CSVs. When a CSV file has only one column (which means it wouldn't have any delimeter, e.g, ","), the workbook created by
XLSX.read()
method gets corrupt in a way that it breaks down cells into strings of lenght 10 when spaces are there in data.E.g: If my CSV data is :
Then my workbook would look like :
and eventually my JSON obejct after
sheet_to_csv
will look something like this :By looking into code I found that this function is causing it :
As the single column CSV file will not have actually any delimeter so it would not be considered CSV and instead
dsv_to_sheet_str()
method,aoa_to_sheet(prn_to_aoa_str())
would return the workbook data.Possible Solution:
Thanks for sharing!
You correctly identified the issue -- when there are no common delimiters, the file is assumed to be lotus PRN. I wonder if the better fix is to just disable PRN parsing by default. It would look like
That would make a new parse option
PRN
which would control whether to enable Lotus PRN parsing. It's only really commonly used in very old files, so it probably doesn't make sense as a default.Feel free to send a PR
Hey, Thanks for quick response. I would agree disabling PRN pasring by default would make more sense. How do I push to your repo?
You have to make your own fork (press the fork button), push to that fork (github will let you push to your own fork), then make a pull request