ExcelScript.DataValidationPrompt interface

Represents the user prompt properties for the data validation.

Remarks

Examples

/**
 * This script creates a text prompt that's shown in C2:C8 when a user enters the cell.
 */
function main(workbook: ExcelScript.Workbook) {
    // Get the data validation object for C2:C8 in the current worksheet.
    let selectedSheet = workbook.getActiveWorksheet();
    let dataValidation = selectedSheet.getRange("C2:C8").getDataValidation();

    // Clear any previous validation to avoid conflicts.
    dataValidation.clear();

    // Create a prompt to remind users to only enter first names in this column.
    const prompt: ExcelScript.DataValidationPrompt = {
      showPrompt: true,
      title: "First names only",
      message: "Only enter the first name of the employee, not the full name."
    }
    dataValidation.setPrompt(prompt);
}    

Properties

message

Specifies the message of the prompt.

showPrompt

Specifies if a prompt is shown when a user selects a cell with data validation.

title

Specifies the title for the prompt.

Property Details

message

Specifies the message of the prompt.

message: string;

Property Value

string

showPrompt

Specifies if a prompt is shown when a user selects a cell with data validation.

showPrompt: boolean;

Property Value

boolean

title

Specifies the title for the prompt.

title: string;

Property Value

string