I have a simple array, as shown in the image below
I want to get the office codes in an array. I am using the node exceljs
module to achieve this
As per the example from the github page, I have this piece of code
let array_is =[];
let workbook = new excel.Workbook();
workbook.xlsx.readFile("path_to_file").then(()=>{
var worksheet = workbook.getWorksheet('Sheet1');
var col = worksheet.getColumn(1);
console.log(col.values);
array_is = array_is.push(col.values);
});
console.log(array_is);
However, the array returns []
. If I print the values from the excel alone using a console
statement, the I am able to see the values printed from the excel correctly.
What am I doing wrong in pushing the values to an array. I have also using the toString()
method in the array push statement but the array was not populated.