# filterSpaceSheet

A filtered list from a spreadsheet as a NEW CSV beside it, every row read on the server. Use it for any "the rows where…" job; never retype readSpaceSheet rows into a file or split the job up. `columns`: headers to keep (`as` renames); `where`: conditions all kept rows meet (EMPTY, NOT_EMPTY, or EQUALS, NOT_EQUALS, CONTAINS, NOT_CONTAINS with `values`). A repeated group is `{n}` ("Phone {n} Type") with `repeat` ["1","2","3"]: one row per value that passes; column `{n}` outputs it. Report the returned counts.

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

## Variables

- `input`: `FilterSpaceSheetInput!` (required)
  - `itemId`: `ID!` (required)
  - `versionId`: `ID`
  - `sheet`: `String`. Default: the first visible sheet.
  - `name`: `String!` (required)
  - `columns`: `[SpaceSheetFilterColumn!]!` (required)
    - `column`: `String!` (required)
    - `as`: `String`
  - `where`: `[SpaceSheetFilterCondition!]`
    - `column`: `String!` (required)
    - `operator`: `SpaceSheetFilterOperator!` (required, one of `EQUALS`, `NOT_EQUALS`, `CONTAINS`, `NOT_CONTAINS`, `EMPTY`, `NOT_EMPTY`)
    - `values`: `[String!]`
  - `repeat`: `[String!]`
  - `dropDuplicates`: `Boolean`

## Response (data, an example)

```json
{
  "spacesMutation": {
    "filterSheet": {
      "sheet": "…",
      "columns": [
        "…"
      ],
      "rowsRead": 0,
      "rowsWritten": 0,
      "duplicatesDropped": 0,
      "rowsPerRepeat": [
        {
          "value": "…",
          "rows": 0
        }
      ],
      "preview": "…",
      "item": {
        "id": "<ID>",
        "name": "…",
        "fileType": "…",
        "sizeBytes": 0,
        "spaceId": "<ID>",
        "parentId": "<ID>"
      }
    }
  }
}
```

## 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": "filterSpaceSheet",
    "variables": {
      "input": {
        "itemId": "<itemId>",
        "name": "<String>",
        "columns": [
          {
            "column": "<String>"
          }
        ]
      }
    }
  }'
```
