How to create the cell dropdown list programmatically using excel4node.js in node.js?

Issue

I have used the excel4node js to create & download the excel file. I want to create the cell dropdown list in excel sheet dynamically.
i.e. I have the 10 values from B1 to B10 cell, then i need to make cell C1 to C10 as dropdown list and the dropdown should contain values from b1 to b10.
so the user allows to select the value for c1 to c10 cells using the dropdown list.

How to do this using excel4node js?

Solution

You can simply use ws.addDataValidation:

ws.addDataValidation({
    type: 'list',
    allowBlank: 1,
    sqref: 'C1:C10',
    formulas: [
        '=$B$1:$B$10'
    ]
});

You can also find all other option documented in https://www.npmjs.com/package/excel4node

Answered By – Nicolas Després

Answer Checked By – Senaida (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.