MCP
data:sortRange
Sorts the range.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sheet | string | yes | — |
range | { from: string; to: string } | yes | The rectangle to permute. Nothing outside it is read or written. |
sortColumn | string | yes | The column whose values order the rows, as an A1 column letter, "A", "AB". Must lie inside range. |
direction | "asc", "desc" | yes | Sort order for sortColumn's values. |
Returns
| Name | Type | Required | Description |
|---|---|---|---|
range | { from: string; to: string } | yes | The normalized rectangle actually sorted. |
sortColumn | string | yes | The sort column, canonical uppercase. |
direction | "asc", "desc" | yes | Sort order for sortColumn's values. |
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 rectangle to permute. Nothing outside it is read or written.",
"$ref": "#/$defs/CellRange"
},
"sortColumn": {
"description": "The column whose values order the rows, as an A1 column letter, `\"A\"`, `\"AB\"`. Must lie inside `range`.",
"type": "string"
},
"direction": {
"$ref": "#/$defs/SortDirection"
}
},
"required": [
"sheet",
"range",
"sortColumn",
"direction"
],
"$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"
]
},
"SortDirection": {
"description": "Sort order for `sortColumn`'s values.",
"type": "string",
"enum": [
"asc",
"desc"
]
}
}
}Response payload, as JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Output",
"type": "object",
"properties": {
"range": {
"description": "The normalized rectangle actually sorted.",
"$ref": "#/$defs/CellRange"
},
"sortColumn": {
"description": "The sort column, canonical uppercase.",
"type": "string"
},
"direction": {
"$ref": "#/$defs/SortDirection"
}
},
"required": [
"range",
"sortColumn",
"direction"
],
"$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"
]
},
"SortDirection": {
"description": "Sort order for `sortColumn`'s values.",
"type": "string",
"enum": [
"asc",
"desc"
]
}
}
}