I need a JavaScript to export HTML tables to Excel. I have tried this script, but it is only exporting one table:
<script type="text/javascript">
function CreateExcelSheet()
{
var x=myTable.rows
var xls = new ActiveXObject("Excel.Application")
xls.visible = true
xls.Workbooks.Add
for (i = 0; i < x.length; i++)
{
var y = x[i].cells
for (j = 0; j < y.length; j++)
{
xls.Cells( i+1, j+1).Value = y[j].innerText
}
}
}
</script>
<input type="button" onclick="CreateExcelSheet()" value="Create Excel Sheet">
<table id='myTable'>
<td>
<tr>
.
.
.
.
So, is there any code that I can have to export N number of tables in the HTML?