I am reading excel by using exceljs
module. When my excel file in same folder. It works fine.
var workbook = new Excel.Workbook();
workbook.xlsx.readFile('Data.xls')
.then(function() {
var worksheet = workbook.getWorksheet(sheet);
worksheet.eachRow({ includeEmpty: true }, function(row, rowNumber) {
console.log("Row " + rowNumber + " = " + JSON.stringify(row.values));
});
});
But When my excel file in some other folder and I try to give fileName with path, It throws console error, that file not found. my file structure is like below:
TestFolder
|------nodemodules/
|------example/js/e2e/fileServer.js
|------data/Data.xls
My Question is How to provide relative path of excel file in readFile()
. I want to provide path for Data.xls
in fileServer.js
file.