TRUECALC
MCP

data:setNamedRange

Sets the named range.

Parameters

NameTypeRequiredDescription
sheetstringyesThe sheet range is relative to.
namestringyesThe named range's identifier, e.g. "MyRange".
range{ from: string; to: string }yesThe rectangle to bind name to.

Returns

NameTypeRequiredDescription
namestringyesEchoed exactly as the caller sent it, never trimmed or re-cased.
range{ from: string; to: string }yesNot a raw echo of whatever case or corner order range.from/range.to arrived in.
createdbooleanyestrue when this call DEFINED a brand-new name, false when it RETARGETED an existing one.

Schema

Request payload, as JSON Schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Payload",
  "description": "`commandId` is not modeled.",
  "type": "object",
  "properties": {
    "sheet": {
      "description": "The sheet `range` is relative to.",
      "type": "string"
    },
    "name": {
      "description": "The named range's identifier, e.g. `\"MyRange\"`.",
      "type": "string"
    },
    "range": {
      "description": "The rectangle to bind `name` to.",
      "$ref": "#/$defs/CellRange"
    }
  },
  "required": [
    "sheet",
    "name",
    "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": {
    "name": {
      "description": "Echoed exactly as the caller sent it, never trimmed or re-cased.",
      "type": "string"
    },
    "range": {
      "description": "Not a raw echo of whatever case or corner order `range.from`/`range.to` arrived in.",
      "$ref": "#/$defs/CellRange"
    },
    "created": {
      "description": "`true` when this call DEFINED a brand-new name, `false` when it RETARGETED an existing one.",
      "type": "boolean"
    }
  },
  "required": [
    "name",
    "range",
    "created"
  ],
  "$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"
      ]
    }
  }
}

On this page