How to export HTML tables to a single excel workbook with different sheets?

You can create an Excel workbook with multiple sheets and retain formatting (including colspan and rowspan) using SheetJS. Here is a discussion thread and examples posted in that thread:

1) Workbook with Multiple Sheets

Demo (Click Excel link): (by reviewher)