ExcelScript.WorksheetSearchCriteria interface

Represents the worksheet search criteria to be used.

Remarks

Examples

/**
 * This script searches through a worksheet and finds cells containing "No". 
 * Those cells are filled with the color red.
 * Use Range.find instead of Worksheet.findAll when you want to limit the search to a specific range.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the current, active worksheet.
  const worksheet = workbook.getActiveWorksheet();

  // Get all the cells that exactly contain the string "No".
  const searchCriteria: ExcelScript.WorksheetSearchCriteria = { 
    completeMatch: true,
    matchCase: true
  };
  const noCells = worksheet.findAll("No", searchCriteria);

  // Set the fill color to red.
  noCells.getFormat().getFill().setColor("red");
}

Properties

completeMatch

Specifies if the match needs to be complete or partial. A complete match matches the entire contents of the cell. A partial match matches a substring within the content of the cell (e.g., cat partially matches caterpillar and scatter). Default is false (partial).

matchCase

Specifies if the match is case-sensitive. Default is false (case-insensitive).

Property Details

completeMatch

Specifies if the match needs to be complete or partial. A complete match matches the entire contents of the cell. A partial match matches a substring within the content of the cell (e.g., cat partially matches caterpillar and scatter). Default is false (partial).

completeMatch?: boolean;

Property Value

boolean

matchCase

Specifies if the match is case-sensitive. Default is false (case-insensitive).

matchCase?: boolean;

Property Value

boolean