GoliathDevelopersGet an API key
Reference/Spacesgenerated from the gateway manifest

filterSpaceSheet

A filtered list from a spreadsheet as a NEW CSV beside it, every row read on the server.

POST/api/v1/callWRITEidempotent · 24 hruns as the key's owner
View as Markdown

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.

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>"
          }
        ]
      }
    }
  }'
import { GoliathClient } from '@goliath-data/sdk'

const goliath = new GoliathClient({
  apiKey: process.env.GOLIATH_API_KEY!,
  baseUrl: 'https://server.goliathdata.com',
})

const result = await goliath.spaces.filterSpaceSheet(
  {
    input: {
      itemId: '<itemId>',
      name: '<String>',
      columns: [
        {
          column: '<String>'
        }
      ]
    }
  },
  { idempotencyKey: crypto.randomUUID() },
)
const res = await fetch('https://server.goliathdata.com/api/v1/call', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    operationId: 'filterSpaceSheet',
    variables: {
      input: {
        itemId: '<itemId>',
        name: '<String>',
        columns: [
          {
            column: '<String>'
          }
        ]
      }
    }
  }),
})
const { data, errors } = await res.json()

Variables

The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.

inputFilterSpaceSheetInput!required
itemIdID!required
versionIdID
sheetString

Default: the first visible sheet.

nameString!required
columns[SpaceSheetFilterColumn!]!required
where[SpaceSheetFilterCondition!]
repeat[String!]
dropDuplicatesBoolean
Every field, all the way down
variables
[
  {
    "name": "input",
    "type": "FilterSpaceSheetInput!",
    "required": true,
    "description": null,
    "defaultValue": null,
    "fields": [
      {
        "name": "itemId",
        "type": "ID!",
        "required": true,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "versionId",
        "type": "ID",
        "required": false,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "sheet",
        "type": "String",
        "required": false,
        "description": "Default: the first visible sheet.",
        "defaultValue": null
      },
      {
        "name": "name",
        "type": "String!",
        "required": true,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "columns",
        "type": "[SpaceSheetFilterColumn!]!",
        "required": true,
        "description": null,
        "defaultValue": null,
        "fields": [
          {
            "name": "column",
            "type": "String!",
            "required": true,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "as",
            "type": "String",
            "required": false,
            "description": null,
            "defaultValue": null
          }
        ]
      },
      {
        "name": "where",
        "type": "[SpaceSheetFilterCondition!]",
        "required": false,
        "description": null,
        "defaultValue": null,
        "fields": [
          {
            "name": "column",
            "type": "String!",
            "required": true,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "operator",
            "type": "SpaceSheetFilterOperator!",
            "required": true,
            "description": null,
            "defaultValue": null,
            "enumValues": [
              "EQUALS",
              "NOT_EQUALS",
              "CONTAINS",
              "NOT_CONTAINS",
              "EMPTY",
              "NOT_EMPTY"
            ]
          },
          {
            "name": "values",
            "type": "[String!]",
            "required": false,
            "description": null,
            "defaultValue": null
          }
        ]
      },
      {
        "name": "repeat",
        "type": "[String!]",
        "required": false,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "dropDuplicates",
        "type": "Boolean",
        "required": false,
        "description": null,
        "defaultValue": null
      }
    ]
  }
]

Response

What comes back under data: a list shows as one entry, and a value as its type.

response shape
{
  "data": {
    "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>"
        }
      }
    }
  }
}

Errors

Idempotency

Send an Idempotency-Key of 1 to 255 characters. A finished request retried with the same key replays its stored response, marked Idempotency-Replayed: true; one still in flight returns 409 idempotency_conflict. Keys expire after 24 hours. Write without fear →