amit shukla

amit shukla

  • NA
  • 78
  • 66.3k

Excel download.

Jun 17 2017 4:48 AM
Hi Friends,
 
Today i am facing a problem.
i have a aspx page and this page have html table, which contain 5000 above rows .
i want download this html table as excel formate with the the help of javascript code but when i download then it will give error.
So plz give any suggession. 
 
my javascript code is define below.
 
var a = document.createElement('a');
var data_type = 'data:application/vnd.ms-excel';
var table_div = document.getElementById('dataTable');
var table_html = table_div.outerHTML.replace(/ /g, '%20');
a.href = data_type + ', ' + table_html;
a.download = 'Sample.xls';
a.click();
e.preventDefault();
 

Answers (6)