Google Sheets ACTION
Add Conditional Formatting
Add a conditional formatting rule to a range in Google Sheets, so cells style themselves based on their contents — highlight values over a threshold, flag blanks, color-code by text, or apply a red-to-green color scale. Use this when the user wants formatting driven by the data ('highlight anything over 100', 'make overdue rows red', 'heat-map the revenue column'). For formatting that applies to cells regardless of their value, use Format Cells instead. Use Get Spreadsheet Info to discover worksheet names and Read Rows to see the values you're writing a rule against.
range is A1 notation WITHOUT the worksheet name (B2:B100, C:C). values supplies the numbers/text the condition compares against: one value for most conditions, two for NUMBER_BETWEEN, none for IS_BLANK/IS_NOT_BLANK/COLOR_SCALE, and a formula starting with = for CUSTOM_FORMULA. Example: to highlight revenue cells above 10000 with a light green fill, call with sheetName="Financials", range="B2:B100", condition="NUMBER_GREATER", values="10000", backgroundColor="light green" → returns the rule that was created and its index on the sheet. See the documentation- Action
- Writes data
- OAuth
- SDK
- MCP
IMPLEMENTATION
Call this tool
Connect a user's Google Sheets account once, then configure and run Add Conditional Formatting from your backend or agent.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "google_sheets-add-conditional-formatting",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
google_sheets: { authProvisionId: "apn_xxxxxxx" },
spreadsheetId: "Spreadsheet ID",
sheetName: "Worksheet Name",
},
})
console.log(result)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "google_sheets-add-conditional-formatting",
"configured_props": {
"google_sheets": { "authProvisionId": "apn_xxxxxxx" },
"spreadsheetId": "Spreadsheet ID",
"sheetName": "Worksheet Name"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "google_sheets",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "google_sheets-add-conditional-formatting",
arguments: {
spreadsheetId: "Spreadsheet ID",
sheetName: "Worksheet Name",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| Property | Type | Description |
|---|---|---|
spreadsheetId Spreadsheet ID | string | The spreadsheet ID from the Google Sheets URL. Use List Spreadsheets to find it by name. Required |
sheetName Worksheet Name | string | The worksheet (tab) name. Use Get Spreadsheet Info to discover worksheet names. Required |
range Range | string | The cells the rule applies to, in A1 notation and WITHOUT the worksheet name. Examples: B2:B100, C:C (a whole column), A2:F50. Exclude the header row so the header isn't styled by the rule. Required |
condition Condition | string | What has to be true of a cell for the formatting to apply. COLOR_SCALE is different from the rest: instead of a pass/fail test it shades every cell on a gradient from lowest to highest value, configured with minColor/midColor/maxColor — and it rejects backgroundColor/textColor/bold/italic, which only apply to the pass/fail conditions. Required |
values Values | string | The value(s) the condition compares against. One value for most conditions ( 10000, Overdue), two comma-separated values for NUMBER_BETWEEN (10,20), none for IS_BLANK, IS_NOT_BLANK and COLOR_SCALE. If a value itself contains a comma, pass a JSON array instead so it isn't split — e.g. ["Smith, John"]. For CUSTOM_FORMULA pass a formula starting with = that is relative to the first cell of the range, e.g. =$D2="Overdue". For DATE_BEFORE/DATE_AFTER pass either a date (2026-09-01) or one of PAST_YEAR, PAST_MONTH, PAST_WEEK, YESTERDAY, TODAY, TOMORROW. Optional |
backgroundColor Background Color | string | Fill color applied to cells that match, as a hex code ( #d9ead3) or a common name (light green, light red). Not used by COLOR_SCALE. Optional |
textColor Text Color | string | Font color applied to cells that match. Not used by COLOR_SCALE. Optional |
bold Bold | boolean | Bold the text of cells that match. Not used by COLOR_SCALE. Optional |
italic Italic | boolean | Italicize the text of cells that match. Not used by COLOR_SCALE. Optional |
minColor Min Color | string | COLOR_SCALE only — color for the lowest value in the range. Defaults to #ffffff (white). Optional |
midColor Mid Color | string | COLOR_SCALE only — color for the median (50th percentile) value. Omit for a two-color scale. Optional |
maxColor Max Color | string | COLOR_SCALE only — color for the highest value in the range. Defaults to #57bb8a (green). Optional |
REFERENCE
Tool details
Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.
- Registry key
- google_sheets-add-conditional-formatting
- Version
- 0.0.1
- App
- Google Sheets
- Authentication
- OAuth
- Read-only
- No
- Destructive
- No
- Open world
- Yes
- Source
- View on GitHub ↗