MCP
read:getConditionalFormats
Gets the conditional formats.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sheet | string | yes | — |
Returns
| Name | Type | Required | Description |
|---|---|---|---|
rules | array of { id: string; range: object; rule: object or object or object } | yes | Every conditional-format rule on sheet, in real precedence order. |
Schema
Request payload, as JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Payload",
"type": "object",
"properties": {
"sheet": {
"type": "string"
}
},
"required": [
"sheet"
]
}Response payload, as JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Output",
"type": "object",
"properties": {
"rules": {
"description": "Every conditional-format rule on `sheet`, in real precedence order.",
"type": "array",
"items": {
"$ref": "#/$defs/ConditionalFormatRuleInfo"
}
}
},
"required": [
"rules"
],
"$defs": {
"ConditionalFormatRuleInfo": {
"description": "One conditional-format rule's identity, target rectangle, and definition.",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"range": {
"$ref": "#/$defs/CellRange"
},
"rule": {
"$ref": "#/$defs/RuleOut"
}
},
"required": [
"id",
"range",
"rule"
]
},
"CellRange": {
"description": "An inclusive rectangle. `from`/`to` may be equal, a single cell.",
"type": "object",
"properties": {
"from": {
"description": "Top-left cell, e.g. `\"A1\"`.",
"type": "string"
},
"to": {
"description": "Bottom-right cell, e.g. `\"B3\"`.",
"type": "string"
}
},
"required": [
"from",
"to"
]
},
"RuleOut": {
"description": "One rule's definition, as reported back by this command.",
"oneOf": [
{
"type": "object",
"properties": {
"operator": {
"$ref": "#/$defs/OperatorOut"
},
"value": {
"type": "number",
"format": "double"
},
"value2": {
"type": [
"number",
"null"
],
"format": "double"
},
"style": {
"$ref": "#/$defs/CellFormat"
},
"kind": {
"type": "string",
"const": "singleCondition"
}
},
"required": [
"kind",
"operator",
"value",
"style"
]
},
{
"type": "object",
"properties": {
"minColor": {
"$ref": "#/$defs/HexColor"
},
"maxColor": {
"$ref": "#/$defs/HexColor"
},
"kind": {
"type": "string",
"const": "colorScale"
}
},
"required": [
"kind",
"minColor",
"maxColor"
]
},
{
"type": "object",
"properties": {
"formula": {
"type": "string"
},
"style": {
"$ref": "#/$defs/CellFormat"
},
"kind": {
"type": "string",
"const": "customFormula"
}
},
"required": [
"kind",
"formula",
"style"
]
}
]
},
"OperatorOut": {
"description": "A single-condition rule's operator, as reported back by this command.",
"type": "string",
"enum": [
"greaterThan",
"greaterThanOrEqual",
"lessThan",
"lessThanOrEqual",
"equal",
"notEqual",
"between",
"notBetween"
]
},
"CellFormat": {
"description": "A cell's grid-owned presentation.",
"type": "object",
"properties": {
"bold": {
"description": "Bold text. Absent or `false` = not bold.",
"type": [
"boolean",
"null"
]
},
"italic": {
"description": "Italic text.",
"type": [
"boolean",
"null"
]
},
"strike": {
"description": "Struck-through text.",
"type": [
"boolean",
"null"
]
},
"underline": {
"description": "Underlined text.",
"type": [
"boolean",
"null"
]
},
"fontFamily": {
"description": "Font family. Absent = the grid's default face.",
"anyOf": [
{
"$ref": "#/$defs/FontFamily"
},
{
"type": "null"
}
]
},
"fontSize": {
"description": "Font size in points. Absent = the grid's default size.",
"anyOf": [
{
"$ref": "#/$defs/FontSize"
},
{
"type": "null"
}
]
},
"borders": {
"description": "Per-edge cell borders. Absent = no borders, never present-and-empty.",
"anyOf": [
{
"$ref": "#/$defs/CellBorders"
},
{
"type": "null"
}
]
},
"color": {
"description": "Text colour. Absent = the grid's default.",
"anyOf": [
{
"$ref": "#/$defs/Color"
},
{
"type": "null"
}
]
},
"fill": {
"description": "Background fill. Absent = none, the grid's own background shows.",
"anyOf": [
{
"$ref": "#/$defs/Color"
},
{
"type": "null"
}
]
},
"numberFormat": {
"description": "Number-display category. Absent = automatic, the engine's raw display.",
"anyOf": [
{
"$ref": "#/$defs/NumberFormat"
},
{
"type": "null"
}
]
},
"decimals": {
"anyOf": [
{
"$ref": "#/$defs/Decimals"
},
{
"type": "null"
}
]
},
"align": {
"description": "Horizontal alignment. Absent = automatic, numbers right, else left.",
"anyOf": [
{
"$ref": "#/$defs/HAlign"
},
{
"type": "null"
}
]
},
"valign": {
"description": "Vertical alignment. Absent = bottom, Sheets' default.",
"anyOf": [
{
"$ref": "#/$defs/VAlign"
},
{
"type": "null"
}
]
},
"wrap": {
"description": "Wrap text into lines within the column width, growing the row to fit.",
"type": [
"boolean",
"null"
]
},
"rotation": {
"description": "Text rotation in degrees. Absent, or `0` = none.",
"anyOf": [
{
"$ref": "#/$defs/Rotation"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"FontFamily": {
"description": "A font family name.",
"type": "string"
},
"FontSize": {
"description": "A font size in points.",
"type": "number",
"format": "double"
},
"CellBorders": {
"description": "A cell's borders, any **non-empty** subset of the four edges.",
"type": "object",
"properties": {
"bottom": {
"description": "The bottom edge, if drawn.",
"anyOf": [
{
"$ref": "#/$defs/BorderEdge"
},
{
"type": "null"
}
]
},
"left": {
"description": "The left edge, if drawn.",
"anyOf": [
{
"$ref": "#/$defs/BorderEdge"
},
{
"type": "null"
}
]
},
"right": {
"description": "The right edge, if drawn.",
"anyOf": [
{
"$ref": "#/$defs/BorderEdge"
},
{
"type": "null"
}
]
},
"top": {
"description": "The top edge, if drawn.",
"anyOf": [
{
"$ref": "#/$defs/BorderEdge"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"BorderEdge": {
"description": "One drawn edge: how it looks.",
"type": "object",
"properties": {
"style": {
"description": "The line pattern.",
"$ref": "#/$defs/BorderStyle"
},
"weight": {
"description": "The line weight.",
"$ref": "#/$defs/BorderWeight"
},
"color": {
"description": "The line colour.",
"$ref": "#/$defs/Color"
}
},
"additionalProperties": false,
"required": [
"style",
"weight",
"color"
]
},
"BorderStyle": {
"description": "Line pattern for an edge, Sheets' solid / dashed / dotted plus the double rule.",
"oneOf": [
{
"description": "An unbroken line.",
"type": "string",
"const": "solid"
},
{
"description": "A dashed line.",
"type": "string",
"const": "dashed"
},
{
"description": "A dotted line.",
"type": "string",
"const": "dotted"
},
{
"description": "Two parallel lines.",
"type": "string",
"const": "double"
}
]
},
"BorderWeight": {
"description": "Line weight, Sheets' thin / medium / thick.",
"oneOf": [
{
"description": "The default pen.",
"type": "string",
"const": "thin"
},
{
"description": "One step heavier.",
"type": "string",
"const": "medium"
},
{
"description": "The heaviest pen.",
"type": "string",
"const": "thick"
}
]
},
"Color": {
"description": "A CSS colour string, `#ff0000`, `#fff2cc`, `rgb(…)`, a named colour.",
"type": "string"
},
"NumberFormat": {
"description": "A number-display category, studio#10.",
"oneOf": [
{
"description": "Grouped fixed-point: `1,234.57`.",
"type": "string",
"const": "number"
},
{
"description": "The value times 100, with a `%` suffix.",
"type": "string",
"const": "percent"
},
{
"description": "Grouped fixed-point with a currency symbol.",
"type": "string",
"const": "currency"
},
{
"description": "The value read as a date serial. **Implies date typing**.",
"type": "string",
"const": "date"
},
{
"description": "The value read as a date-time serial.",
"type": "string",
"const": "datetime"
}
]
},
"Decimals": {
"type": "integer",
"format": "uint8",
"minimum": 0,
"maximum": 255
},
"HAlign": {
"description": "Horizontal text alignment.",
"oneOf": [
{
"description": "Hug the left edge of the cell box.",
"type": "string",
"const": "left"
},
{
"description": "Centre within the cell box.",
"type": "string",
"const": "center"
},
{
"description": "Hug the right edge of the cell box.",
"type": "string",
"const": "right"
}
]
},
"VAlign": {
"description": "Vertical text alignment within the cell box.",
"oneOf": [
{
"description": "Top of the cell box.",
"type": "string",
"const": "top"
},
{
"description": "Vertically centred.",
"type": "string",
"const": "middle"
},
{
"description": "Bottom of the cell box, Sheets' default.",
"type": "string",
"const": "bottom"
}
]
},
"Rotation": {
"description": "Text rotation in degrees: positive tilts counter-clockwise, Sheets' \"up\", negative clockwise, \"down\".",
"type": "number",
"format": "double"
},
"HexColor": {
"description": "A strictly-validated `#rgb`/`#rrggbb`/`#rrggbbaa` hex colour.",
"type": "string"
}
}
}