Posted 20 June 2019, 2:34 am EST
Hello team!
I’m trying to read a .xlsx file from a test server and I get the error “Incorrect file format”. I followed the following tutorial https://www.grapecity.com/blogs/how-to-importexport-excel-files-using-javascript-and-spread-sheets
My page is located on a github page:
https://gricardov.github.io
When I add data to the table and press “Generar excel” (generate excel), it should read a template, modify it and download it. It all works when I start a local server on my computer, but not on github/heroku server. Please help me.
This is my code:
function leerPlantilla() {
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("excel"));
return new Promise((resolve, reject) => {
var excelUrl = "plantillas/formatoGlassgowSimple.xlsx";
var oReq = new XMLHttpRequest();
oReq.open('get', excelUrl, true);
oReq.responseType = 'blob';
oReq.onload = function () {
var blob = oReq.response;
excelIO.open(blob, (json) => {
jsonData = json;
workbook.fromJSON(json);
workbook.setActiveSheet("1");
resolve(workbook);
}, function (message) {
console.log(message);
reject('No se pudo leer')
});
};
oReq.send(null);
})
}
Thanks in advance
