Excel Export create multiple sheets

Excel Export create multiple sheets

novrobnovrob Posts: 3Questions: 1Answers: 0

This is the example that kthorngren http://live.datatables.net/qinoxinu/6/edit
created and i been trying to add a third sheet and want to add additional sheets
for example http://live.datatables.net/hayofusa/1/edit

So I tried to duplicate the function but all it does is either error out and display blank tables or display the third table as the second and third sheet.
I am missing a part and i have looked at all the examples and posts.

Answers

  • kthorngrenkthorngren Posts: 9,792Questions: 25Answers: 2,258

    I looked at it for a bit but not sure exactly what needs to be set to add a third sheet. In the addSheet() function there are some hard coded references to sheet2.xml. I think this is part of the problem so I changed them to sheet' + sheetId + '.xml'. Its close, if you repair the spreadsheet when opening it does open but as you mention the 2nd and 3rd contain the same data. Probably a relationship is not being set properly.
    http://live.datatables.net/kuyayeto/1/edit

    There are more changes needed but not sure what they are. It will take understanding the Open XML format to correctly add the sheets. I have pointers to the docs in the thread where I posted the above example. Someone more familiar with Open XML may see this and offer help. But likely it will take reading through the docs to find the proper way to add a sheet.

    Kevin

  • novrobnovrob Posts: 3Questions: 1Answers: 0

    Kevin,

    Thanks for the update, the issue appears with the ID of the sheet, it clones the ID 3 and ignores any additional id's.
    So i have to figure out how to insert a new ID for sheet 3 and tie to the workbook. if anyone else looks at the example you have to rename the excel sheet from .xlsx to zip and then extract it and look at the structure of the workbook. I keep working on it once I have working solution i post it here for others.

  • you2525you2525 Posts: 17Questions: 3Answers: 0

    Hi, have you solved your issue ? I'm really interested to look at the way you did it.

  • you2525you2525 Posts: 17Questions: 3Answers: 0

    I fixed the issue : http://live.datatables.net/kuyayeto/9/edit
    It works great, as many sheets as you want. I changed 'rId3' by 'rId'+sheetId+1, i looked into the zip to help me, thanks !

  • novrobnovrob Posts: 3Questions: 1Answers: 0

    That is good news, I had to put it aside until I could work on it some more. i will try this out this weekend.

    Thank you for posting an updated.

Sign In or Register to comment.