Adds a data validation rule to the active sheet of a spreadsheet workbook. Pass a struct with range (A1 cell range), type (list, whole, decimal, textLength, date or custom, default list), operator (between, notBetween, greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, equal or notEqual) and the bound expressions formula1 and formula2. For a list type, formula1 is a quoted, comma-separated list such as "Red,Green,Blue" or a range reference. Blank cells are allowed. The fluent member form is addDataValidation({...}).
spreadsheetAddDataValidation(spreadsheetObj, validationStruct)
→ returns any
A dropdown of Red/Green/Blue on A2:A10.
wb = Spreadsheet("xlsx");
spreadsheetAddDataValidation(wb, {
range: "A2:A10",
type: "list",
formula1: "\"Red,Green,Blue\""
});
A numeric between rule on B2:B20.
wb = Spreadsheet("xlsx");
spreadsheetAddDataValidation(wb, {
range: "B2:B20",
type: "whole",
operator: "between",
formula1: "1",
formula2: "10"
});
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.