XLSX.stream.to_json doesn't ends when a blank row is the last row in Excel sheet.
See original GitHub issuesheetjs/bits/97_node.js
stream._read = function() {
if(R > r.e.r) return stream.push(null);
while(R <= r.e.r) {
//if ((rowinfo[R-1]||{}).hidden) continue;
var row = make_json_row(sheet, r, R, cols, header, hdr, dense, o);
++R;
if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) {
stream.push(row.row);
break;
}
}
};
return stream;
Hi @SheetJSDev !
This piece of code has the R > r.e.r
checking outside of the loop but when a blank row is inserted at the end of a given sheet then the if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows))
condition inside of the while loop isn’t executed and the stream does not end.
Ill be submitting a pull request for the same for a fix for this issue that I have found. Please verify and merge the changes as soon as possible as I am using this library in production in my system.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Locate and reset the last cell on a worksheet - Microsoft Support
To locate the last cell that contains data or formatting, click anywhere in the worksheet, and then press CTRL+END. Note: To select the...
Read more >Finding the Last Row in an Excel Spreadsheet From Java
In this tutorial, we'll discuss how to find the last row in an Excel spreadsheet using Java and Apache POI.
Read more >Parse XLSX with Node and create json - Stack Overflow
Yeah, by default it doesn't process blank cells but by passing an optional param to XLSX.readFile function is a way around. var workbook...
Read more >read-excel-file - npm
Sidenote: When converting cell values to object properties, by default, it skips all null values (skips all empty cells). That's for simplicity.
Read more >Pandas read_excel() - Reading Excel File in Python
If the excel sheet doesn't have any header row, pass the header parameter value as None. excel_data_df = pandas.read_excel('records.xlsx', ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m having the same issue. I noticed that setting
blankrows: true
will emit the end event. Here my reproducible problem:I know the range of the sheet that has data in it, so I am specifying it manually, e.g.
When doing this the
end
event gets emitted, without it noend
event happens.