Only parse enough to get headers #409
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#409
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?
Hey,
There are a couple options for the read functions such as 'bookProps' and 'bookSheets' that when set to true limit the scope of the parse. These are great because when I use them the read takes 60% less time, which makes sense because of the limited parse scope.
My question is, is there a way to have the read only parse enough to return the headers, as I don't actually need more than that, and it's a lot of extra time spent on data I'm not actually using. If there isn't could you point me in the direction of how to customize?
Thanks for any help.
The
sheetRows
option limits the number of rows that the parser will consider when generating cells. If you just want the first row, set the optionsheetRows:1
in the options object when you call read or readFile. For example with the AutoFilter.xlsb test file:Does this option work on the browser? we need a browser-only in which users may upload big files up to 6GB but we would like to preview the first few lines as soon as possible.
Per the example in https://github.com/SheetJS/js-xlsx/issues/409#issuecomment-286002080, I'm not showing that the
!fullref
shows for all file types. If I doXLSX.read('someFile.csv', {sheetRows:1})
, for example, I just get the !ref bounded by 1, but !fullref is undefined.What file types does this !fullref functionality not appear for?
sheetRows: 1
will pull the first row from each sheet.@elgalu yes the parameter merely says to stop processing cells after that point in the worksheet.
@adamjaffeback formats that self-report worksheet ranges (XLS / XLSX / XLSB / ODS) will have
!fullref
. They are the self-reported ranges and may not be accurate (some writers cheat by intentionally reporting a range like A1:C1 or A1:C1048576). For CSV, getting the full range means determining the number of rows and columns, which would require processing the the entire file.