googleSheets.createConditionalFormatRule() inserts a boolean or gradient rule into one sheet’s conditional-format priority list.
Example
Inputs
Providespreadsheet, one or more ranges on the same sheet, and rule. A range can be a structured one-based grid range or a table target with optional section: all, header, body, or footer. The action resolves table targets to fixed grid ranges when it creates the rule. Later table resizing doesn’t change those ranges automatically.
Optional index is the zero-based insertion priority and defaults to 0, the highest priority. Inserting, moving, or deleting rules can shift their per-sheet indexes.
Define a boolean rule
A boolean rule hastype: "boolean", a typed condition, and format. Conditions accept only these documented forms:
- One
value:numberGreaterThan,numberGreaterThanOrEqual,numberLessThan,numberLessThanOrEqual,numberEqual,numberNotEqual,textContains,textNotContains,textStartsWith,textEndsWith,textEqual, ordateEqual - Exactly two
values:numberBetweenornumberNotBetween - One literal or relative-date
value:dateBeforeordateAfter. Relative dates are{ relativeDate: "pastYear" | "pastMonth" | "pastWeek" | "yesterday" | "today" | "tomorrow" } - No value:
blankornotBlank customFormulawithformulastarting with=or+
bold, italic, strikethrough, textColor, and backgroundColor. Google doesn’t accept borders, underline, alignment, or other cell-format properties for conditional rules.
Define a gradient rule
A gradient rule hastype: "gradient", required min and max interpolation points, and optional midpoint. Every point supplies color. The minimum accepts type: "min" without a value, the maximum accepts type: "max" without a value, and either extreme accepts type: "number" | "percent" | "percentile" with a string value. A midpoint accepts only one of those value-based types.
All colors are either a six-digit hex string or { theme }, where theme is text, background, accent1 through accent6, or link. Second argument { account } selects the Google Account. All action inputs accept compatible signals.
Output
Returns{ index, ranges, rule }. Ranges use zero-based, end-exclusive indexes and numeric sheetId.