If you want to export HTML content to excel using JavaScript, apply this code
HTML:
<button type="button" class="btn btn-small pull-right" id="Export2Excel">Export To Excel</button>
JS:
$("#Export2Excel").click(function(e) { let file = new Blob([$('#FinalForm').html()], {type:"application/vnd.ms-excel"}); console.log('file', file); let url = URL.createObjectURL(file); console.log('url', url); let a = $("<a />", {href: url,download: "filename.xls"}).appendTo("body").get(0).click(); console.log('a', a); e.preventDefault(); });
Question and answer is powered by AnsPress.io