MCP
edit:findReplace
Finds and replaces text within a range.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sheet | string | yes | — |
range | { from: string; to: string } or null | no | The scope to search, the whole sheet's occupied footprint when absent. |
query | string | yes | — |
replacement | string | yes | — |
matchCase | boolean | no | Defaults to false. |
useRegex | boolean | no | Defaults to false. |
matchEntireCell | boolean | no | Defaults to false. |
withinFormulas | boolean | no | Defaults to false. |
Returns
| Name | Type | Required | Description |
|---|---|---|---|
queryCompiled | boolean | yes | Whether query compiled as a regex, always true when useRegex is false, since the literal form is always regex::escaped before compiling, escaping cannot fail. |
matched | integer | yes | How many scope cells' search text matched, counted whether or not the match was eligible to be written back. |
Schema
Request payload, as JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Payload",
"type": "object",
"properties": {
"sheet": {
"type": "string"
},
"range": {
"description": "The scope to search, the whole sheet's occupied footprint when absent.",
"anyOf": [
{
"$ref": "#/$defs/CellRange"
},
{
"type": "null"
}
]
},
"query": {
"type": "string"
},
"replacement": {
"type": "string"
},
"matchCase": {
"type": "boolean",
"default": false
},
"useRegex": {
"type": "boolean",
"default": false
},
"matchEntireCell": {
"type": "boolean",
"default": false
},
"withinFormulas": {
"type": "boolean",
"default": false
}
},
"required": [
"sheet",
"query",
"replacement"
],
"$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"
]
}
}
}Response payload, as JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Output",
"description": "This command's own extra result fields.",
"type": "object",
"properties": {
"queryCompiled": {
"description": "Whether `query` compiled as a regex, always `true` when `useRegex` is `false`, since the literal form is always `regex::escape`d before compiling, escaping cannot fail.",
"type": "boolean"
},
"matched": {
"description": "How many scope cells' search text matched, counted whether or not the match was eligible to be written back.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"queryCompiled",
"matched"
]
}