Question
problem with load of xlsx file
Hi everyone,
in my project I want to load information from an xls or xlsx file.
My idea is to:
1. load xlxs/xls file
2. convert to json file
3. use the json
I tried to setup this piece of code, that is actually running for *.txt or *.json file:
//\\ ** CARICAMENTO LISTA RICAMBI ** //\\
$scope.app.cad.loadXLSfile=function(fileName){
var xmlhttp = new XMLHttpRequest(); //apertura del file sequenze
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log(">> this: "+ this)
listaRicambi = JSON.parse(this.response)
console.log(listaRicambi) // repair_sequence รจ il nome dell'oggetto indicato nel file .txt formattato con grammatica json
}
};
xmlhttp.open("GET", "app/resources/Uploaded/" + fileName + ".xlsx", true);
xmlhttp.send();
}
So, when I inspect the preview mode console print some error like:
Uncaught SyntaxError: Unexpected token P in JSON at position 0
at JSON.parse (<anonymous>)
at XMLHttpRequest.xmlhttp.onreadystatechange (app.js?v1611219048987:568)
Any idea?
Thank you so much.

