Posted 29 December 2020, 12:34 pm EST
Hi
Trying to load a server Excel file into the VueJS SpreadJS example as a proof of concept for data capture to then load into a database.
imported Excel as ‘@grapecity\spread-excelio’ after npm install (v 14.04)
Hacking dataService.js and added
getDataFromFile() {
let xhr = new XMLHttpRequest();
xhr.open('GET', 'http://localhost:3000/src/assets/data.xlsx', true);
xhr.setRequestHeader(
"Content-type",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8"
);
xhr.responseType = 'blob';
xhr.send();
xhr.onloadend = function () {
if (xhr.status != 200) {
alert(`Error loading file`);
} else {
console.log(xhr.response);
return xhr.response;
}
}
}
And changed the dataSource property in SpreadSheet.vue to getDataFromFile().
I get a blob back but only 803 bytes (and I know the file is 100kb)
What am I missing?
Thanks