<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.2/xlsx.min.js"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"> </script>
<script>
var wb = XLSX.utils.book_new();
$('.special-table').each(function(i,item){
var table_id = $(this).attr('id')
var sheet_name = table_id.replace('-table','')
console.log(table_id);
wb.SheetNames.push(sheet_name)
var ws = XLSX.utils.table_to_sheet(document.getElementById(table_id));
wb.Sheets[sheet_name] = ws;
})
var wbout = XLSX.write(wb, {bookType:'xlsx', bookSST:true, type: 'binary'});
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i=0; i<s.length; i++) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
$("#download").click(function(){
saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), 'ppe_report.xlsx');
});
</script>
I followed the guide here: https://redstapler.co/sheetjs-tutorial-html-table-to-excel/
As the title states, this is in-browser. Can anyone help? Any help or advice is appreciated, right now I am scratching my head. Thanks in advance
I needed to use xlsx.full.min.js, not xlsx.min.js