TRUECALC
MCP

read:getRange

Gets the range.

Parameters

NameTypeRequiredDescription
sheetstringyesThe sheet name.
range{ from: string; to: string }yesThe inclusive rectangle to read.

Returns

NameTypeRequiredDescription
range{ from: string; to: string }yesThe rectangle this call answered for, completely.
cells{ [key: string]: { value?: any; display: string; formula?: string or null; rawInput: string; format: object } }yesOne entry per address in range, keyed by its plain A1 form.

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"
    }
  },
  "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"
      ]
    }
  }
}

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"
    },
    "cells": {
      "description": "One entry per address in `range`, keyed by its plain A1 form.",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/Cell"
      }
    }
  },
  "required": [
    "range",
    "cells"
  ],
  "$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"
      ]
    },
    "Cell": {
      "description": "One cell's read-back.",
      "type": "object",
      "properties": {
        "value": {
          "description": "`unknown` already covers the `null` case too, so no separate `| null` is needed."
        },
        "display": {
          "description": "**Known Batch-0 approximation**. Not a real number-format-aware render, a plain literal rendering of `value`.",
          "type": "string"
        },
        "formula": {
          "type": [
            "string",
            "null"
          ]
        },
        "rawInput": {
          "description": "The formula string when present, otherwise the same approximation as `display`.",
          "type": "string"
        },
        "format": {
          "description": "This cell's effective format.",
          "$ref": "#/$defs/CellFormat"
        }
      },
      "required": [
        "display",
        "rawInput",
        "format"
      ]
    },
    "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"
    }
  }
}

On this page