In my current project, I am dealing with a basic array structure, which can be seen in the visual representation below
https://i.sstatic.net/gNbXa.png
My goal is to extract the office codes contained in this array. To accomplish this task, I have opted to utilize the exceljs
module within Node.js environment
Following an illustration provided on the official GitHub page, I have implemented the following code snippet
let extractedValues =[];
let workbook = new excel.Workbook();
workbook.xlsx.readFile("path_to_file").then(()=>{
var worksheet = workbook.getWorksheet('Sheet1');
var column = worksheet.getColumn(1);
console.log(column.values);
extractedValues = extractedValues.push(column.values);
});
console.log(extractedValues);
Despite my efforts, the resulting array appears empty []
. When inspecting the individual values from the Excel document via a console
statement, I observe the correct values being displayed.
I'm perplexed as to what mistake I may be making in populating the array. I even attempted using the toString()
method during the push operation but encountered the same issue of an empty array