TRUECALC
MCP

format:setDecimals

Sets the decimals.

Parameters

NameTypeRequiredDescription
sheetstringyesThe sheet name.
range{ from: string; to: string }yesThe target range, e.g. {"from": "A1", "to": "B3"}. May legitimately arrive "backwards", from below/right of to, normalized before use.
valueintegeryesThe decimal count to set. 0 is a real value here.
numberFormat"number", "percent", "currency", "date", "datetime" or nullnoAn optional companion category to set alongside value in the same call. Omitted, not merely null means "leave the category alone". Defaults to null.

Returns

Nothing beyond the standard MCP success envelope.

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 target range, e.g. `{\"from\": \"A1\", \"to\": \"B3\"}`. May legitimately arrive \"backwards\", `from` below/right of `to`, normalized before use.",
      "$ref": "#/$defs/CellRange"
    },
    "value": {
      "description": "The decimal count to set. `0` is a real value here.",
      "$ref": "#/$defs/Decimals"
    },
    "numberFormat": {
      "description": "An optional companion category to set alongside `value` in the same call. Omitted, not merely `null` means \"leave the category alone\".",
      "anyOf": [
        {
          "$ref": "#/$defs/NumberFormat"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "sheet",
    "range",
    "value"
  ],
  "$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"
      ]
    },
    "Decimals": {
      "type": "integer",
      "format": "uint8",
      "minimum": 0,
      "maximum": 255
    },
    "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"
        }
      ]
    }
  }
}

On this page