MCP
read:getValues
Gets the values.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sheet | string | yes | The sheet name. |
range | { from: string; to: string } | yes | The inclusive rectangle to read. |
layers | "values", "formulas", "both" | no | Which layer(s) to read. Google Sheets' own getValues() default. |
encoding | "rows", "a1" | no | How to shape values/formulas in the response. Defaults to "rows". |
Returns
| Name | Type | Required | Description |
|---|---|---|---|
range | { from: string; to: string } | yes | The rectangle this call answered for, completely. |
rows | integer | yes | range's row count. |
cols | integer | yes | range's column count. |
encoding | "rows", "a1" | yes | Echoes the requested shape, so a caller reading values/formulas out of band still knows how to interpret it. |
nonEmpty | array of string | yes | Every address in range whose display text is non-empty or which holds a formula, in row-major, reading order, the sparse summary a caller wants before paying to decode a mostly-empty rectangle. |
values | any | no | Present iff layers was values/both. Row-major Vec<Vec<String>> or an A1-keyed map, depending on encoding. |
formulas | any | no | Present iff layers was formulas/both. Same shape rule as values, an empty string where a cell holds no formula. |
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 inclusive rectangle to read.",
"$ref": "#/$defs/CellRange"
},
"layers": {
"$ref": "#/$defs/Layers",
"default": "values"
},
"encoding": {
"$ref": "#/$defs/Encoding",
"default": "rows"
}
},
"required": [
"sheet",
"range"
],
"$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"
]
},
"Layers": {
"description": "Which layer(s) to read. Google Sheets' own `getValues()` default.",
"type": "string",
"enum": [
"values",
"formulas",
"both"
]
},
"Encoding": {
"description": "How to shape `values`/`formulas` in the response.",
"oneOf": [
{
"description": "Row-major arrays: `values[i][j]` is the cell at `range`'s `i`-th row, `j`-th column.",
"type": "string",
"const": "rows"
},
{
"description": "A map keyed by plain A1 form, `\"A1\"`, one entry per address in `range`.",
"type": "string",
"const": "a1"
}
]
}
}
}Response payload, as JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Output",
"type": "object",
"properties": {
"range": {
"description": "The rectangle this call answered for, completely.",
"$ref": "#/$defs/CellRange"
},
"rows": {
"description": "`range`'s row count.",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"cols": {
"description": "`range`'s column count.",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"encoding": {
"description": "Echoes the requested shape, so a caller reading `values`/`formulas` out of band still knows how to interpret it.",
"$ref": "#/$defs/Encoding"
},
"nonEmpty": {
"description": "Every address in `range` whose display text is non-empty or which holds a formula, in row-major, reading order, the sparse summary a caller wants before paying to decode a mostly-empty rectangle.",
"type": "array",
"items": {
"type": "string"
}
},
"values": {
"description": "Present iff `layers` was `values`/`both`. Row-major `Vec<Vec<String>>` or an A1-keyed map, depending on `encoding`."
},
"formulas": {
"description": "Present iff `layers` was `formulas`/`both`. Same shape rule as `values`, an empty string where a cell holds no formula."
}
},
"required": [
"range",
"rows",
"cols",
"encoding",
"nonEmpty"
],
"$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"
]
},
"Encoding": {
"description": "How to shape `values`/`formulas` in the response.",
"oneOf": [
{
"description": "Row-major arrays: `values[i][j]` is the cell at `range`'s `i`-th row, `j`-th column.",
"type": "string",
"const": "rows"
},
{
"description": "A map keyed by plain A1 form, `\"A1\"`, one entry per address in `range`.",
"type": "string",
"const": "a1"
}
]
}
}
}