Help me, how to read worksheets rows OnDemand, using NodeJs with stream? #2918
Following this doc. I would like to read the file pausedly, that is, I would like to read only the first records, not the whole file. How do I do this with Node.js stream?
There are multiple related questions:
"How do I read the first N records?". The
sheetRows option limits the number of rows processed.
"How do I read from a NodeJS stream?": This is not currently supported for technical reasons. The docs have an explanation:
XLSX, XLSB, NUMBERS, and ODS files are ultimately ZIP files that contain binary and XML entries. The ZIP file format stores the table of contents ("end of central directory" record) at the end of the file, so a proper parse of a ZIP file requires scanning from the end. Streams do not provide random access into the data, so the only correct approach involves buffering the entire stream.
You can buffer the stream and call
XLSX.read at the end.
"How do I incrementally parse a file?": This flow is not currently supported in the open source software but there is a plan to address this flow.
No due date set.
No dependencies set.
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?