I\'ve been looking into some jQuery plugins that are capable of doing this. I decided to use the one at http://www.jqueryscript.net/table/Export-Html-Table-To-Excel-Spreads
VERY IMPORTANT, make sure the columns and rows have width greater than 0, this becomes an issue especially when rows are moved from one table to another table, (I have faced it when I moved rows between two dataTables)
if columns(th) or rows(td) width is 0, you will get the table downloaded as .xls file, but the columns gets hidden in the excel file,
use css or jquery to set the width greater than 0
css
th, td {
width:px;
}
jquery
$(" th").css("width","px");
$(" td").css("width","px");
$("").click(function(e) {
var a = document.createElement('a');
var dataType = 'data:application/vnd.ms-excel';
var getTable = document.getElementById('');
var readTable = getTable.outerHTML.replace(/ /g, '%20');
a.href = dataType + ', ' + readTable;
a.download = '.xls';
a.click();
e.preventDefault();
});