Im trying to read excel files but it returns this code
Error: End of data reached (data length = 0, asked index = 4). Corrupted zip ?
This is the code that I used. I am trying to read excel files from a list of string filenames. But each loop returns the said error above
const ExcelJS = require('exceljs');
function attentionAverage(filenames) {
console.log(filenames);//list of all excel filenames
for (const filename of filenames) {
console.log('Testing Attention_average ' + filename)
var workbook = new ExcelJS.Workbook();
let myPromise = workbook.xlsx.readFile(filename);
// "Consuming Code"
myPromise.then(function() {
// If success
// Read file
console.log("Success");
}, function(err) {
// If fail
console.log('Testing Attention_average ' + filename)
console.log(err);
});
}
}