sheet_to_html does not handle blank sheets gracefully #2835

Open
opened 2022-12-06 18:55:49 +00:00 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?
Author

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 Assignees
2 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#2835
No description provided.