showing results for - "export to excel in javascript"
Stefano
03 Nov 2016
1//Excel export script works on IE7+, Firefox and Chrome.
2
3function fnExcelReport()
4{
5    var tab_text="<table border='2px'><tr bgcolor='#87AFC6'>";
6    var textRange; var j=0;
7    tab = document.getElementById('headerTable'); // id of table
8
9    for(j = 0 ; j < tab.rows.length ; j++) 
10    {     
11        tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
12        //tab_text=tab_text+"</tr>";
13    }
14
15    tab_text=tab_text+"</table>";
16    tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");//remove if u want links in your table
17    tab_text= tab_text.replace(/<img[^>]*>/gi,""); // remove if u want images in your table
18    tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); // reomves input params
19
20    var ua = window.navigator.userAgent;
21    var msie = ua.indexOf("MSIE "); 
22
23    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))      // If Internet Explorer
24    {
25        txtArea1.document.open("txt/html","replace");
26        txtArea1.document.write(tab_text);
27        txtArea1.document.close();
28        txtArea1.focus(); 
29        sa=txtArea1.document.execCommand("SaveAs",true,"Say Thanks to Sumit.xls");
30    }  
31    else                 //other browser not tested on IE 11
32        sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));  
33
34    return (sa);
35}
36//Just create a blank iframe:
37
38<iframe id="txtArea1" style="display:none"></iframe>
39//Call this function on:
40
41<button id="btnExport" onclick="fnExcelReport();"> EXPORT </button>
queries leading to this page
export to excel jsconvert data to excel javascriptcreate excel file using jsjavascript app from excel sheetjavascript excel exporthow to add javascript to excelexport to excel javascriptjs export table to excelexcel to jsjs export table to excel and style itexport html to excel javascripthow to export html to excel in javascriptexport excel with sheetjsjs save as excel how to convert js data to excelguide to convert html to excel in javascriptjs create excel fileexport to excel in node jsconvert excel formula to javascripttable export to excel javascriptexport table excel javascriptexport excel javascript exampleexportar para excel via javascripthow to export html table to excel using javascriptexport to excel in specific format jsjavascript export to excel with formattinghow to export excel sheet using javascriptexport exceljscreate excel file in javascriptjs connect to excelhow to create excel file using javascriptexcel irr to javascriptjavascript to excel filejs excel exporthow to export html to excel by javascriptexport excel jstable to export excel jstable export excel javascriptexport as excel in javascriptexport whole html page to excel using javascriptjs export as excelexport excel html table javascriptjs export exceljavascript to excelexcel export javascriptnode js export data into exceljavascript excel export libraryjs create exceljavascript export excelhow to export all html table in excel using javascriptexport objet data to excel javascriptexport data to excel javascriptjs to excelexport html page to excel using javascriptjavascript to create excel fileexport excel using javascriptexport to excel using javascriptjavascript export to excelcreate excel file in jswrite excel file in javascriptjavascript save file as excelhow to save data on excel javascriptjavascript create excel filejs browser export to excelcreate excel sheet in javascripthow to export excel file in javascripthow to export to excel spreadsheet using javascripthow to print excel file in javascriptcreate excel using javascriptexcel js exportexport excel in javascriptcreate excel file from jsexport to excel from dom html jsexport to excel in javascriptexport table to excel javascriptexportar a excel java scriptfrom js to excel formulaexport html table to excel using javascripthow to export to excel using javascriptexport excel using jsexport from dom to excelhow to convert excel formula to javascriptjavascript save as excel filejs export table to excel with styleuse excel as database javascriptexport excel using exceljsexport list to excel javascriptjs export to excel with stylesimple way to import data from an excel in javascriptprepare excel in javascriptgenerate excel in javascriptjavascript export table to exceljavascript export html table to excel 28xlsx 29 via sheetjsjavascript exporting excel with data in itexport excel sheat js js export data to excelcode to export div value in excel using javascriptjavascript library to export table to exceltable excel export javascriptexport excel file using javascriptexport excel data table javascripthow to import excel file in javascripthow to generate excel file in javascriptjs table to exceljavascript exporta a excelwhy i receive data in excel with javascriptexport to excel in javascript