how to set validation on a column #2478
Replies: 19 comments 3 replies
-
https://github.com/exceljs/exceljs#data-validations ws.getColumn("A").eachCell({ includeEmpty: true }, function(cell, rowNumber) {
cell.dataValidation = {
type: 'list',
allowBlank: true,
formulae: ['"male,female,other"']
};
}); |
Beta Was this translation helpful? Give feedback.
-
Hi @Siemienik , using the above code the validations are only getting added to the column cells which have data during download. How do we add the validation to the entire column when there is data entered or not? |
Beta Was this translation helpful? Give feedback.
-
#1184 may be connected with |
Beta Was this translation helpful? Give feedback.
-
@bhavan0 may you confirm is it working properly? ws.dataValidations.add("X2:X9999",{
type: 'list',
allowBlank: true,
formulae: ['"male,female,other"']
}); |
Beta Was this translation helpful? Give feedback.
-
This works. |
Beta Was this translation helpful? Give feedback.
-
Is this still working for someone? |
Beta Was this translation helpful? Give feedback.
-
Seeing the same error |
Beta Was this translation helpful? Give feedback.
-
Same error. Someone solved this? |
Beta Was this translation helpful? Give feedback.
-
@GowthamGottimukkala did you find a solution to the |
Beta Was this translation helpful? Give feedback.
-
Downgrading the version to 3.3.1 helped and didn't raise any error for the method told by @Siemienik. If I'm not wrong, I checked the time taken by this method and it is almost equal to the following one. So I updated my version and currently using the following as a workaround.
Hope this helps |
Beta Was this translation helpful? Give feedback.
-
Yeah, this is what I ended up doing, still it would've been nice to avoid the |
Beta Was this translation helpful? Give feedback.
-
This works in version 4.2.0:
|
Beta Was this translation helpful? Give feedback.
-
I don't know why the https://github.com/exceljs/exceljs/blob/e1de626/index.d.ts#L984 TS will throw an error if this field is used. Please try to use Unfortunately, I cannot explore this that I would like, because I don't have enough time for volunteer working as earlier. EDIT: This line has been commented since types definitions were created 2b6a2e5#diff-7aa4473ede4abd9ec099e87fec67fd57afafaf39e05d493ab4533acc38547eb8R825 |
Beta Was this translation helpful? Give feedback.
-
Hey, Can we pass the Dynamic dataset in formulae: I am trying to call it but it is throwing an error while opening the excel:
|
Beta Was this translation helpful? Give feedback.
-
Another workaround would be to extend the Worksheet interface... put this into a
I would really like to see #1682 pulled in! I tried the workaround of adding a bunch of empty rows and then setting cell-level validation but it bloats the size of the worksheet (as downloaded). The range-style validation has very little effect upon the resultant file size. |
Beta Was this translation helpful? Give feedback.
-
I want to add a dropdown to a column, but the list array is coming from an API. The array has 185 items, I converted them into the format accepted by the library, but it is showing data till a particular limit. If the item length goes beyond a particular limit it does not show any data. Does anyone have a workaround for this issue? Can we increase the limit of the dropdown list? |
Beta Was this translation helpful? Give feedback.
-
dynamic validation, it took a lot of work to solve it dynamically. Sharing in case anyone has the same problem. worksheet.dataValidations.add("C2:C9999", { |
Beta Was this translation helpful? Give feedback.
-
i want to generate an excel for students where i have a section gender and i want the column to have validation as list = ["male", "female", "other"]
how can i do so
Beta Was this translation helpful? Give feedback.
All reactions