I have this functionality in a simple HTML page and it works fine
head () { return { script: [ { hid: 'alasql', src: 'https://cdn.jsdelivr.net/alasql/0.3/alasql.min.js', defer: true, //callback: () => { this.isStripeLoaded = true } }, { hid: 'ajax', src: 'https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.16.9/xlsx.core.min.js', defer: true, } ] } }, mounted(){ function setPrice(nomer){ var printResult = function(result){ console.log(result[0].te) // var sum= result[0].te }; alasql ("SELECT te FROM XLSX('/MDF_PANELS.XLS') WHERE f = "+nomer+"",[], function (data) {printResult(data);}) } }
But when I move to nuxt application I get the error:
Invalid HTML: could not find <table> at e (xlsx.core.min.js:16)
My xls files are saved in the "static" folder.
I would be happy to get any help.
P粉5473628452024-03-27 00:09:55
First you need to import alasql correctly
import * as alasql from 'alasql'; alasql["private"].externalXlsxLib = require('xlsx');
Secondly use to read and write form Excel and raw data files
This is my code:
sssccc
where "te" is the name of the desired column and "f" is the name of the desired row