CherryBelle
CherryBelle

Reputation: 1422

Exceljs data validation list cause error in Ms. Excel

I use exceljs node module and add dropdown data validation

worksheet.getCell(cell).dataValidation = {
  type: 'list',
  allowBlank: true,
  formulae: ['"One,Two,Three,Four"'],
  showErrorMessage: true,
  errorStyle: 'error',
  errorTitle: 'Error',
  error: 'Value must be in the list'
};

The file successfully generated. But it can only be opened using Libre Office. Opening the file with Ms. Office will cause the following error:

Excel completed file level validation and repair.
Some parts of this workbook mau have been repaired or discarded.
Repaired Part: /xl/worksheets/sheet1.xml part.

How to solve this problem?

Upvotes: 6

Views: 3689

Answers (1)

Christian Læirbag
Christian Læirbag

Reputation: 338

Invert quotation marks in data validation formulae. It only supports and recognizes the other one.

worksheet.getCell(cell).dataValidation=
{
    type : "list",
    allowBlank : true,
    formulae : ["'One,Two,Three,Four'"],//<--------------------------------Right there
    showErrorMessage : true,
    errorStyle : "error",
    errorTitle : "Error",
    error : "Value must be in the list"
};

Upvotes: 2

Related Questions