In ExcelJs package there is dataValidation or _dataValidation attribute for cell object. This gives the type of data in cell like list, dropdown, decimal, boolean etc.
But, for some reason, it is throwing Javascript out of heap memory error for some files, So, I have increased the memory limit to 16GB (it is the max I can use) by node --max-old-space-size=[size_in_GB*1024] index.js
but it failed to parse.
So, I am looking for alternative packages like sheet js and others but I coun't get all the data validations as in ExcelJs mainly options in a dropdown of an Excel file.
Please help me to solve this issue. Thank you.
PS: I have checked this question How to Get the DataType of excel cell value using nodejs version16.14.2 and Vue js and the convert-excel-to-json
don't provide any validations on the cell.
I am getting this error while parsing the particular Excel file.
This is the code snippet that I have used and I got the above error after few minutes.
const ExcelJS = require('exceljs');
const fs = require("fs");
async function readExcelFile(filePath) {
const workbook = new ExcelJS.Workbook();
const stream = fs.createReadStream(filePath);
await workbook.xlsx.read(stream);
const worksheet = workbook.getWorksheet(1);
worksheet.eachRow((row, rowNumber) => {
row.eachCell((cell, colNumber) => {
console.log(cell.dataValidations, cell._dataValidations);
console.log(`Cell value at row ${rowNumber}, column ${colNumber}: ${cell.value}`);
});
});
}
readExcelFile('PAG KIC TAB A (1)(1).xlsx');