I am trying to export data to an excel sheet using alasql
and xlsx
. I have followed all the guidelines here: https://github.com/agershun/alasql/wiki/Xlsx
This is my function:
exportToExcel(data: any) {
console.log(XLSX.version);
alasql
.promise('SELECT * INTO XLSX("test.csv",{headers:true}) FROM ?', [data])
.then(function (data) { console.log(data); })
.catch(function (err) { console.log('Error:', err); });;
}
which gives me this error in my console together with the XLSX
version:
VM9931 main.bundle.js:1044 0.12.4
VM9931 main.bundle.js:1047 Error: Error: Please include the xlsx.js library
at B (VM9930 vendor.bundle.js:6298)
at Object.A.into.XLSX (VM9930 vendor.bundle.js:6303)
The problem I am experiencing is that I have already included the XLSX
library and it's working correctly (the version logged is 0.12.4
). If I change the XLSX("test.csv")...
to CSV("test.csv")...
it exports to CSV perfectly.