Error when opening a generated excel #3093

Open
opened 2024-03-26 14:49:41 +00:00 by evgenirovinsky · 1 comment

Hi SheetJS Team,

We have another question about the library.

We have a use case where we need to combine several generated sheets into one.
Basically, what I need is to put the contents of all the sheets in one sheet one below another.

The sheets were created on a WorkBook object using:
XLSX.utils.aoa_to_sheet (from an array of arrays)
XLSX.utils.table_to_sheet (from an HTML table element)
Then I work directly on the workbook object.
Add another name to SheetNames
Add another sheet object to Sheets
Iterate over the existing sheets and move the cells using the offset of the current sheet.
We use the t,v,z fields from cells for type, value and format
Then I clean up the Sheets object and SheetNames array.
It works, but when opening the excel file this error is shown (attached)

After clicking Yes, the content is open but the sheet name changes to RecoveredSheet1.

Can it be related to the fact that we directly manipulate the sheet object?
Is there a built in method to combine sheet contents vertically ?

NOTE: We also have a custom requirement to add dynamic data between the sheets.
So the output sheet should look like:

Sheet1 content
...
...
custom data
2 empty lines
Sheet2 content
...
...

Any help and information will be highly appreciated.

Thanks,
Evgeni

Hi SheetJS Team, We have another question about the library. We have a use case where we need to combine several generated sheets into one. Basically, what I need is to put the contents of all the sheets in one sheet one below another. The sheets were created on a WorkBook object using: XLSX.utils.aoa_to_sheet (from an array of arrays) XLSX.utils.table_to_sheet (from an HTML table element) Then I work directly on the workbook object. Add another name to SheetNames Add another sheet object to Sheets Iterate over the existing sheets and move the cells using the offset of the current sheet. We use the t,v,z fields from cells for type, value and format Then I clean up the Sheets object and SheetNames array. It works, but when opening the excel file this error is shown (attached) After clicking Yes, the content is open but the sheet name changes to RecoveredSheet1. Can it be related to the fact that we directly manipulate the sheet object? Is there a built in method to combine sheet contents vertically ? NOTE: We also have a custom requirement to add dynamic data between the sheets. So the output sheet should look like: Sheet1 content ... ... custom data 2 empty lines Sheet2 content ... ... Any help and information will be highly appreciated. Thanks, Evgeni
Owner

You can use sheet_add_aoa and sheet_add_dom to build up worksheets.

If you can share a sample file and a sample set of operations, we can take a closer look.

You can use [`sheet_add_aoa`](https://docs.sheetjs.com/docs/api/utilities/array#array-of-arrays-input) and [`sheet_add_dom`](https://docs.sheetjs.com/docs/api/utilities/html#html-table-input) to build up worksheets. If you can share a sample file and a sample set of operations, we can take a closer look.
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#3093
No description provided.