> ## Documentation Index
> Fetch the complete documentation index at: https://docs.custral.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit a spreadsheet

> Set a block of values, append rows, clear a range, add or rename a tab. Operations apply in order and all or nothing; the edit lands live in any open editor. A page of another type returns `404 spreadsheet_not_found`; a caller who can only view it gets `insufficient_permissions`. **Requires scope:** `documents:write`.



## OpenAPI

````yaml /openapi-v1.json patch /v1/spreadsheets/{id}
openapi: 3.1.0
info:
  title: Custral API
  version: v1
  description: >-
    The curated, versioned, API-key-authenticated public REST surface (`/v1`).
    Every endpoint here is what the official SDKs (`@custral/sdk`) and the MCP
    server are built on. Authenticate with a secret API key (`sk_…`) created in
    **Settings → Developers → Applications**.


    Every `/v1` response is sent with **HTTP 200**, success and failure alike. A
    success carries `data`; a failure carries `error` with a machine-readable
    `code` (see the `Error` schema), so branch on `error`, never on the status.
    `POST /v1/mcp` is the one exception: it answers auth failures with real 401
    / 403 / 429 statuses, as MCP clients expect.
  contact:
    name: Custral Support
    email: hello@custral.com
    url: https://custral.com
  license:
    name: Proprietary
    url: https://custral.com
servers:
  - url: https://api.custral.com
    description: Production
security:
  - ApiKey: []
tags:
  - name: Identity
    description: Introspect the calling API key.
  - name: Records
    description: Create, list, retrieve, and update records on any object.
  - name: Objects
    description: Read the object (table) schema of your workspace.
  - name: Conversations
    description: View, manage, and ingest conversations and their messages.
  - name: MCP
    description: Custral's MCP server, and the tool surface a key sees on it.
  - name: Documents
    description: Read record notes / page documents as markdown.
  - name: Connectors
    description: The MCP servers Stella can use tools from.
  - name: Property agents
    description: AI auto-fill agents on properties.
  - name: Usage modules
    description: Metered-product setups, their usage events, and per-record usage.
  - name: Applications & keys
    description: Developer applications and the API keys they hold.
  - name: Widget identity
    description: Vouch for who a chat widget visitor is.
  - name: Embeds & real-time
    description: Read the rows behind your own embed block, with an embed token.
  - name: Lists
    description: Read lists and change who is on them.
  - name: Customer journeys
    description: The workspace's customer journey, and where each customer is in it.
  - name: Quotes
    description: Quotes, contracts and contract templates.
  - name: Billing
    description: >-
      Customer billing, invoices, subscriptions, revenue metrics, the billing
      page, Stripe customer links, billing setup, products and plans.
  - name: Pages
    description: Create document, presentation, whiteboard and spreadsheet pages.
  - name: Presentations
    description: Read a deck and edit its slides.
  - name: Spreadsheets
    description: Read a spreadsheet's values and write to it.
  - name: Whiteboards
    description: Read a whiteboard's shapes and draw on it.
paths:
  /v1/spreadsheets/{id}:
    patch:
      tags:
        - Spreadsheets
      summary: Edit a spreadsheet
      description: >-
        Set a block of values, append rows, clear a range, add or rename a tab.
        Operations apply in order and all or nothing; the edit lands live in any
        open editor. A page of another type returns `404 spreadsheet_not_found`;
        a caller who can only view it gets `insufficient_permissions`.
        **Requires scope:** `documents:write`.
      operationId: editSpreadsheet
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            The spreadsheet page's id (`page_…`), or the `documentId` `POST
            /v1/pages` returned.
          schema:
            type: string
          example: page_123
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditSpreadsheetBody'
      responses:
        '200':
          description: The spreadsheet after the edit.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Spreadsheet'
                  reqId:
                    $ref: '#/components/schemas/RequestId'
components:
  schemas:
    EditSpreadsheetBody:
      type: object
      required:
        - operations
      properties:
        operations:
          type: array
          minItems: 1
          maxItems: 200
          description: Applied in order, all or nothing.
          items:
            $ref: '#/components/schemas/SheetOperation'
    Spreadsheet:
      type: object
      properties:
        id:
          type: string
        sheets:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
              rows:
                type: array
                items:
                  type: array
                  items: {}
                description: Values, row-major; A1 is `rows[0][0]`.
              formulas:
                type: object
                additionalProperties:
                  type: string
                description: Each formula, by A1 cell.
    RequestId:
      type: string
      description: >-
        A per-request id (`req_…`). Quote it to support when reporting a
        problem.
      example: req_2a1f9c8e7b6d5
    SheetOperation:
      oneOf:
        - type: object
          required:
            - kind
            - cell
            - values
          properties:
            kind:
              type: string
              const: set_values
            sheet:
              type: string
              description: A tab title. Omitted, the first tab.
            cell:
              type: string
              example: B2
              description: Top-left cell, A1 notation.
            values:
              type: array
              items:
                type: array
                items:
                  description: >-
                    Text, a number, a boolean, `null` (empty), or a formula
                    `{formula, value}` — `value` is what the cell shows until
                    the sheet recalculates. A bare `"=…"` string is refused.
                  oneOf:
                    - type: string
                    - type: number
                    - type: boolean
                    - type: 'null'
                    - type: object
                      required:
                        - formula
                      properties:
                        formula:
                          type: string
                        value:
                          oneOf:
                            - type: string
                            - type: number
        - type: object
          required:
            - kind
            - values
          properties:
            kind:
              type: string
              const: append_rows
            sheet:
              type: string
              description: A tab title. Omitted, the first tab.
            values:
              type: array
              items:
                type: array
                items:
                  description: >-
                    Text, a number, a boolean, `null` (empty), or a formula
                    `{formula, value}` — `value` is what the cell shows until
                    the sheet recalculates. A bare `"=…"` string is refused.
                  oneOf:
                    - type: string
                    - type: number
                    - type: boolean
                    - type: 'null'
                    - type: object
                      required:
                        - formula
                      properties:
                        formula:
                          type: string
                        value:
                          oneOf:
                            - type: string
                            - type: number
          description: Rows land below the last row that holds a value.
        - type: object
          required:
            - kind
            - range
          properties:
            kind:
              type: string
              const: clear_range
            sheet:
              type: string
              description: A tab title. Omitted, the first tab.
            range:
              type: string
              example: A2:D20
          description: Empties values; formats stay.
        - type: object
          required:
            - kind
            - title
          properties:
            kind:
              type: string
              const: add_sheet
            title:
              type: string
        - type: object
          required:
            - kind
            - sheet
            - title
          properties:
            kind:
              type: string
              const: rename_sheet
            sheet:
              type: string
            title:
              type: string
      discriminator:
        propertyName: kind
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: sk_...
      description: >-
        A Custral API key, created in Settings → Developers → Applications, sent
        as `Authorization: Bearer sk_…`. The `X-Api-Key` header is also accepted
        and takes precedence. Use a **secret** key (`sk_…`) from your server; a
        publishable key (`pk_…`) may hold only `objects:read` and `usage:write`.
        Never expose a secret key in a browser.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.