4

How Do we add data-validation to an entire column in exceljs ? Or Is there any other library that supports such a feature ?

Amol Gupta
  • 2,054
  • 1
  • 14
  • 29

1 Answers1

5

You can reach that by providing fixed number of cells in the target column, assuming the target column is column L, then you can use the following snippet:

sheet.dataValidations.add('L2:L9999', {
  type: 'list',
  allowBlank: false,
  formulae: ['"male,female,other"'],
  showErrorMessage: true,
  errorStyle: 'error',
  error: 'The value Valid',
});

For more info, see the following: how to set validation on a column #1109 & Data validation to the whole column? #614

Ahmed Farag
  • 83
  • 1
  • 7