> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Create conditional format rule

> Create a typed boolean or gradient conditional-format rule in Google Sheets.

`googleSheets.createConditionalFormatRule()` inserts a boolean or gradient rule into one sheet's conditional-format priority list.

## Example

```ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { googleSheets } from "automate.ax/google-sheets"

export default automation("Highlight large orders", () => {
  onDashboardRun({ title: "Highlight large orders" })

  googleSheets.createConditionalFormatRule({
    spreadsheet: "spreadsheet-id",
    ranges: [{ table: "OrdersTable", section: "body" }],
    rule: {
      type: "boolean",
      condition: { type: "numberGreaterThan", value: "1000" },
      format: {
        backgroundColor: "#FCE8E6",
        bold: true,
        textColor: "#C5221F",
      },
    },
  })
})
```

## Inputs

Provide `spreadsheet`, 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 has `type: "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`, or `dateEqual`
* Exactly two `values`: `numberBetween` or `numberNotBetween`
* One literal or relative-date `value`: `dateBefore` or `dateAfter`. Relative dates are `{ relativeDate: "pastYear" | "pastMonth" | "pastWeek" | "yesterday" | "today" | "tomorrow" }`
* No value: `blank` or `notBlank`
* `customFormula` with `formula` starting with `=` or `+`

Conditional formatting supports only `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 has `type: "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`.
