Excel Worksheet using Javascript table

Excel Worksheet using Javascript table

HTML

<script src="http://yourjavascript.com/119112369/xlsx.js"></script>
<script src="http://yourjavascript.com/152186169/jszip.js"></script>
<script src="http://yourjavascript.com/621719612/jszip-load.js"></script>
<script src="http://yourjavascript.com/421961176/jszip-inflate.js"></script>
<script src="http://yourjavascript.com/611912518/jszip-deflate.js"></script>
Worksheet Name:
<input type="text" value="CustomName" id="WName" />
<br/>
<br/>
<table id="Worksheet1">
   

                                            <thead><tr><th rowspan="2">ParentAsin</th><th rowspan="2">ChildAsin</th><th rowspan="2">Title</th><th rowspan="2">Sku</th><th rowspan="2">Category</th><th colspan="3">Aug-2017</th><th colspan="3">Jul-2017</th><th colspan="6">Aug-2017 vs Jul-2017</th><th colspan="3">Aug-2018</th><th colspan="6">Aug-2018 vs Aug-2017</th><th colspan="3">Jul-2018</th><th colspan="6">Aug-2018 vs Jul-2018</th></tr><tr><th>UnitsOrders</th><th>TotalValue</th><th>PerUnitPrice</th><th>UnitsOrders</th><th>TotalValue</th><th>PerUnitPrice</th><th>Units</th><th>Difference</th><th>Value</th><th>Difference</th><th>Unit Price</th><th>Difference</th><th>UnitsOrders</th><th>TotalValue</th><th>PerUnitPrice</th><th>Units</th><th>Difference</th><th>Value</th><th>Difference</th><th>Unit Price</th><th>Difference</th><th>UnitsOrders</th><th>TotalValue</th><th>PerUnitPrice</th><th>Units</th><th>Difference</th><th>Value</th><th>Difference</th><th>Unit Price</th><th>Difference</th></tr></thead>
                                            <tbody></tbody>
                                           ...

JavaScript

$('#save').on('click', function () {
    var file = {
        worksheets: [
            []
        ], // worksheets has one empty worksheet (array)
        creator: 'John Smith',
        created: new Date('8/16/2012'),
        lastModifiedBy: 'Larry Jones',
        modified: new Date(),
        activeWorksheet: 0
    }, w = file.worksheets[0]; // cache current worksheet
    w.name = $('#WName').val();
    $('#Worksheet1').find('tr').each(function () {
        var r = w.push([]) - 1; // index of current row
        $(this).find('input').each(function () {
            w[r].push(this.value);
        });
    });

    window.location = xlsx(file).href();
});