The first empty rows aren't displayed #2737

Closed
opened 2022-07-11 04:17:51 +00:00 by nghuuphuoc · 2 comments
nghuuphuoc commented 2022-07-11 04:17:51 +00:00 (Migrated from github.com)

Sample spreadsheet:
Untitled-spreadsheet.xlsx

Screen Shot 2022-07-11 at 11 16 17

The top first five rows are empty. I would like to see them as well. However, it seems that the library ignores them:

Screen Shot 2022-07-11 at 11 13 38

Is that a bug or default behavior? Is there any option for displaying first empty rows?

Sample spreadsheet: [Untitled-spreadsheet.xlsx](https://github.com/SheetJS/sheetjs/files/9080859/Untitled-spreadsheet.xlsx) ![Screen Shot 2022-07-11 at 11 16 17](https://user-images.githubusercontent.com/4226036/178187520-df4146bd-6542-4934-9d79-f3cedc674ee2.png) The top first five rows are empty. I would like to see them as well. However, it seems that the library ignores them: ![Screen Shot 2022-07-11 at 11 13 38](https://user-images.githubusercontent.com/4226036/178187579-10a83363-f40f-4c34-ad2b-2546f690cecd.png) Is that a bug or default behavior? Is there any option for displaying first empty rows?
nghuuphuoc commented 2022-07-11 04:18:18 +00:00 (Migrated from github.com)

cc @hiepsieunhan

cc @hiepsieunhan
SheetJSDev commented 2022-08-01 08:40:28 +00:00 (Migrated from github.com)

This is a very weird case because the worksheet itself reports the starting cell as A6. You can pin the worksheet to A1 as follows:

/* ws is the worksheet, e.g. workbook.Sheets["Sheet1"] */
var range = XLSX.utils.decode_range(ws["!ref"]);
range.s.r = range.s.c = 0; // force range to start at A1
ws["!ref"] = XLSX.utils.encode_range(range);

We can update the demo with that effect on each worksheet after reading the file.

Changing the library would probably require a version bump since it would break sheet_to_json behavior when the first few rows are blank

This is a very weird case because the worksheet itself reports the starting cell as A6. You can pin the worksheet to A1 as follows: ```js /* ws is the worksheet, e.g. workbook.Sheets["Sheet1"] */ var range = XLSX.utils.decode_range(ws["!ref"]); range.s.r = range.s.c = 0; // force range to start at A1 ws["!ref"] = XLSX.utils.encode_range(range); ``` We can update the demo with that effect on each worksheet after reading the file. Changing the library would probably require a version bump since it would break `sheet_to_json` behavior when the first few rows are blank
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2737
No description provided.