sheet_to_html does not handle blank sheets gracefully #2835

Open
opened 2 months ago by codybreene · 2 comments

Currently, sheet_to_html fails when it attempts to parse a blank sheet because the decode_range helper function does not find the !ref key within the ws object (because it is empty).

Because there is not a book_to_html function, I'm using the sheet_to_html function to parse multiple sheets in a workbook, but some may be empty. Can we update the sheet_to_html function to do a null check on the sheet and return early?

Currently, `sheet_to_html` fails when it attempts to parse a blank sheet because the `decode_range` helper function does not find the `!ref` key within the `ws` object (because it is empty). Because there is not a `book_to_html` function, I'm using the `sheet_to_html` function to parse multiple sheets in a workbook, but some may be empty. Can we update the `sheet_to_html` function to do a null check on the sheet and return early?
Owner

Sure, and other methods should also check null object or missing worksheet range.

In the case of sheet_to_html, is it preferable to throw an error or generate an empty table?

Sure, and other methods should also check null object or missing worksheet range. In the case of `sheet_to_html`, is it preferable to throw an error or generate an empty table?
Poster

Thanks! I think generating an empty table makes sense.

Thanks! I think generating an empty table makes sense.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2835
Loading…
There is no content yet.