I am a little new to javascript. I have got one javascript function which is generating xlsx file from HTML table. It's working fine but as soon as the file gets generated, it's downloading the file instead I am looking to save it on my server. The function is like below
function ExportToExcel(type, fn, dl) {
var elt = document.getElementById('tour');
var wb = XLSX.utils.table_to_book(elt, { sheet: "sheet1" });
return dl ?
XLSX.write(wb, { bookType: type, bookSST: true, type: 'base64' }):
XLSX.writeFile(wb, fn || ('MySheetName.' + (type || 'xlsx')));
}
and I am calling it like below:
onclick="ExportToExcel('xlsx')"
How to store the file instead of downloading it?
Not understanding why you want to generate XLSX on the Client and save it to the server later on. I suggest you generate it on the server itself.
Take a look at answers to this question if you want to save/generate an XLSX file in Node.JS.