MCP
format:setBorders
Sets the borders.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sheet | string | yes | The sheet name. |
range | { from: string; to: string } | yes | The target range, e.g. {"from": "A1", "to": "B3"}. May legitimately arrive "backwards", from below/right of to, normalized before use. |
mode | "all", "inner", "horizontal", "vertical", "outer", "left", "top", "right", "bottom", "clear" | yes | Which edges to target. |
edge | { style: "solid", "dashed", "dotted", "double"; weight: "thin", "medium", "thick"; color: string } | yes | How the targeted edges should look. Required even for mode: clear, parsed but unused there. |
Returns
Nothing beyond the standard MCP success envelope.
Schema
Request payload, as JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Payload",
"type": "object",
"properties": {
"sheet": {
"description": "The sheet name.",
"type": "string"
},
"range": {
"description": "The target range, e.g. `{\"from\": \"A1\", \"to\": \"B3\"}`. May legitimately arrive \"backwards\", `from` below/right of `to`, normalized before use.",
"$ref": "#/$defs/CellRange"
},
"mode": {
"description": "Which edges to target.",
"$ref": "#/$defs/BorderMode"
},
"edge": {
"description": "How the targeted edges should look. Required even for `mode: clear`, parsed but unused there.",
"$ref": "#/$defs/BorderEdge"
}
},
"required": [
"sheet",
"range",
"mode",
"edge"
],
"$defs": {
"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"
]
},
"BorderMode": {
"description": "The Sheets border-position options.",
"oneOf": [
{
"description": "Every edge of every cell in the range.",
"type": "string",
"const": "all"
},
{
"description": "The internal grid lines only, neither the range's outer perimeter.",
"type": "string",
"const": "inner"
},
{
"description": "The internal horizontal grid lines only, between rows.",
"type": "string",
"const": "horizontal"
},
{
"description": "The internal vertical grid lines only, between columns.",
"type": "string",
"const": "vertical"
},
{
"description": "The range's outer perimeter only.",
"type": "string",
"const": "outer"
},
{
"description": "The range's left edge only.",
"type": "string",
"const": "left"
},
{
"description": "The range's top edge only.",
"type": "string",
"const": "top"
},
{
"description": "The range's right edge only.",
"type": "string",
"const": "right"
},
{
"description": "The range's bottom edge only.",
"type": "string",
"const": "bottom"
},
{
"description": "Removes borders instead of drawing them, `edge` is parsed but never read for this mode.",
"type": "string",
"const": "clear"
}
]
},
"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"
}
}
}