ExcelScript.DataValidationType enum

Represents the data validation type enum.

Remarks

Examples

/**
 * This sample reads and logs the data validation type of the currently selected range.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the currently selected range.
  let range = workbook.getSelectedRange();

  // Get the type (`DataValidationType`) of data validation applied to the range.
  let validationType = range.getDataValidation().getType();

  /*
   * Log the data validation type.
   * If the range has a single value, it logs that type.
   * If the range doesn't have data validation applied, it logs "None".
   * If the range has multiple different types of data validation, it logs "Inconsistent" or "MixedCriteria".
   */
  console.log(validationType.toString());
}

Fields

custom

The custom data validation type.

date

The date data validation type.

decimal

The decimal data validation type.

inconsistent

Inconsistent means that the range has inconsistent data validation, indicating that there are different rules on different cells.

list

The list data validation type.

mixedCriteria

Mixed criteria means that the range has data validation present on some but not all cells.

none

None means allow any value, indicating that there is no data validation in the range.

textLength

The text length data validation type.

time

The time data validation type.

wholeNumber

The whole number data validation type.