Here is the pure javascript solution.Check this out.
<script type="text/javascript">
var tableToExcel = (function() {
var uri = 'data:application/vnd.ms-excel;base64,'
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head></head><body><table>{table}</table></body></html>'
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
return function(table, name) {
if (!t
DEMO
http://jsfiddle.net/insin/cmewv/[
^]
For more info check this :
http://stackoverflow.com/questions/14125819/export-html-table-to-excel-but-select-a-name-for-the-file[
^]
UPDATE
Export table data to Excel using jQuery
http://jquerybyexample.blogspot.com/2012/10/export-table-data-to-excel-using-jquery.html[
^]
NOTE: If you need to work above code on IE then,
Quote:
you need to set response header. If you are using ASP.NET then
Response.AddHeader("Content-Disposition", "attachment;filename=download.xls");
I hope this will help to you.