# editSpaceSheetCells

Change cells of a spreadsheet (.xlsx, CSV, TSV) by A1 address as one new version, without re-sending the sheet: each of `edits` writes `values` (rows of cells) right and down from its `start` cell (a value, a formula (`=SUM(B2:B9)`) or "" to clear) and `appendRows` adds rows under the last filled row. Every other cell, sheet, hidden sheet, number format, column width and row height stays as it was, and every formula on the sheet is computed again (one over another sheet keeps the value Excel saved), so read it back with readSpaceSheet for totals. A value is written as typed: a plain number as a number, anything else (a date, "$1,200") as text. Pass the `versionId` readSpaceSheet returned as `baseVersionId`: a save since is refused. At most 10,000 cells per call. An .xlsx with charts, images, pivot tables, comments, Excel tables, macros, conditional formatting, data validation, sparklines, links to other workbooks, data connections, slicers or embedded objects is refused (a save would drop them); cell colours and fonts are not kept, as when it is edited in Library.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "editSpaceSheetCells", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `input`: `EditSpaceSheetCellsInput!` (required)
  - `itemId`: `ID!` (required)
  - `baseVersionId`: `ID!` (required). The versionId the cells were read from; refused if someone saved since.
  - `sheet`: `String`. Default: the first visible sheet.
  - `edits`: `[SpaceSheetCellEdit!]`. Cells written right and down from `start`: a value, a formula (`=…`), or "" to clear the cell.
    - `start`: `String!` (required). The top-left cell, as B2.
    - `values`: `[[String!]!]!` (required)
  - `appendRows`: `[[String!]!]`. Rows added under the sheet's last filled row, from column A.

## Response (data, an example)

```json
{
  "spacesMutation": {
    "editSheetCells": {
      "sheet": "…",
      "cellsChanged": 0,
      "rowsAppended": 0,
      "rowCount": 0,
      "columnCount": 0,
      "item": {
        "id": "<ID>",
        "name": "…",
        "fileType": "…",
        "sizeBytes": 0,
        "currentVersion": {
          "id": "<ID>",
          "versionNumber": 0
        }
      }
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "editSpaceSheetCells",
    "variables": {
      "input": {
        "itemId": "<itemId>",
        "baseVersionId": "<baseVersionId>"
      }
    }
  }'
```
