Constructs a data-validation rule from the settings applied to the builder.
Creates a builder for a data-validation rule based on this rule's settings.
Returns true if the rule shows a warning when input fails data validation, or false if it rejects the input entirely.
Returns true if the rule shows a warning when input fails data validation, or false if it rejects the input entirely. The default for new data-validation rules is true.
Gets the rule's criteria type as defined in the DataValidationCriteria enum.
Gets the rule's criteria type as defined in the DataValidationCriteria enum. To get the arguments for the criteria, use getCriteriaValues(). To use these values to create or modify a data-validation rule, see withCriteria(criteria, args).
Gets an array of arguments for the rule's criteria.
Gets an array of arguments for the rule's criteria. To get the criteria type, use getCriteriaType(). To use these values to create or modify a data-validation rule, see withCriteria(criteria, args).
Gets the rule's help text, or null if no help text is set.
Sets the data-validation rule to require a date.
Sets the data-validation rule to require a date after the given value.
Sets the data-validation rule to require a date after the given value. The time fields of the Date object are ignored; only the day, month, and year fields are used.
Sets the data-validation rule to require a date before the given value.
Sets the data-validation rule to require a date before the given value. The time fields of the Date object are ignored; only the day, month, and year fields are used.
Sets the data-validation rule to require a date between the given values, inclusive of the values themselves.
Sets the data-validation rule to require a date between the given values, inclusive of the values themselves. The time fields of the Date objects are ignored; only the day, month, and year fields are used.
Sets the data-validation rule to require a date equal to the given value.
Sets the data-validation rule to require a date equal to the given value. The time fields of the Date object are ignored; only the day, month, and year fields are used.
Sets the data-validation rule to require a date not between the given values, inclusive of the values themselves.
Sets the data-validation rule to require a date not between the given values, inclusive of the values themselves. The time fields of the Date objects are ignored; only the day, month, and year fields are used.
Sets the data-validation rule to require a date on or after the given value.
Sets the data-validation rule to require a date on or after the given value. The time fields of the Date object are ignored; only the day, month, and year fields are used.
Sets the data-validation rule to require a date on or before the given value.
Sets the data-validation rule to require a date on or before the given value. The time fields of the Date object are ignored; only the day, month, and year fields are used.
Sets the data-validation rule to require that the given formula evaluates to true.
Sets the data-validation rule to require that the given formula evaluates to true. This method is only available in the new version of Google Sheets.
Sets the data-validation rule to require a number between the given values, inclusive of the values themselves.
Sets the data-validation rule to require a number equal to the given value.
Sets the data-validation rule to require a number greater than the given value.
Sets the data-validation rule to require a number greater than or equal to the given value.
Sets the data-validation rule to require a number less than the given value.
Sets the data-validation rule to require a number less than or equal to the given value.
Sets the data-validation rule to require a number not between the given values, inclusive of the values themselves.
Sets the data-validation rule to require a number not equal to the given value.
Sets the data-validation rule to require that the input contains the given value.
Sets the data-validation rule to require that the input does not contain the given value.
Sets the data-validation rule to require that the input is equal to the given value.
Sets the data-validation rule to require that the input is in the form of an email address.
Sets the data-validation rule to require that the input is in the form of a URL.
Sets the data-validation rule to require that the input is equal to one of the given values, with an option to hide the dropdown menu.
Sets the data-validation rule to require that the input is equal to one of the given values.
Sets the data-validation rule to require that the input is equal to a value in the given range, with an option to hide the dropdown menu.
Sets the data-validation rule to require that the input is equal to a value in the given range.
Sets whether to show a warning when input fails data validation or whether to reject the input entirely.
Sets whether to show a warning when input fails data validation or whether to reject the input entirely. The default for new data-validation rules is true.
Sets the help text shown when the user hovers over the cell on which data-validation is set.
Sets the data-validation rule to require criteria defined in the DataValidationCriteria enum.
Sets the data-validation rule to require criteria defined in the DataValidationCriteria enum. This is an advanced method used primarily to create a new data-validation rule based on the criteria and arguments of an existing rule; in most other cases, the require...() methods are easier to use.
DataValidationBuilder Builder for data-validation rules. // Set the data validation for cell A1 to require a value from B1:B10. var cell = SpreadsheetApp.getActive().getRange('A1'); var range = SpreadsheetApp.getActive().getRange('B1:B10'); var rule = SpreadsheetApp.newDataValidation().requireValueInRange(range).build(); cell.setDataValidation(rule);