Search code examples
javascriptobjectparsingxlsxxlsx-populate

JS xlsx-populate parse password protected excel file data


How to get the data from the columns?

enter image description here

So far I am able to get an object as a whole workbook:

enter image description here

I also believe that the column data (cells) should be accessed in that "_rows" property (not sure about that).

Below is the code, I am using xlsx-populate lib, because it's the only one to read password protected files (as I didn't find any other libs to do that).

const readExcelFile = () => {
            xlsxPopulate.fromFileAsync(__dirname + "excelfile.xlsx", {password: "abc12345"})
            .then(workbook => {
                    console.log(workbook);
            });  
    };

So far I've had bad luck accessing the properties inside this Workbook object because this is a circular reference. Also tried JSON.stringify'ing the object but this doesn't work either.

Any suggestions on how to get that data would be highly appreciated.


Solution

  • Solved by using circular-json lib.