Using ExcelJS to load a grid with existing excel file, gives incorrect dataValidation values

14 Views Asked by At

Here, my excel sheet have few cells that contains data validations with values as ['Yes', 'No', 'NotApplicable'].

dropdown options

While iterating to each row and then cells within that row, I extract the dataValidations as cell.dataValidations. For most of the excel files I get the exact values in the dropdown, but a file that is protected doesn't give the exact values in the dropdown, rather gives values as (_null, _B, _A) .

Is there a way to get the exact values from the dropdown for protected files?

Here is how I extract the validations for each cell.

    worksheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
      row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
        if (cell.dataValidation === undefined) {
          rowData.values.push({
            value: cell.value,
            number: colNumber,
            address: cell._address,
            validation: cell.dataValidation,
          });
        }
      });
    });

The options in validation should be ['Yes', 'No'].

0

There are 0 best solutions below