{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Export & Import (No OAuth)",
    "description": "Send any Apify dataset or JSON to Google Sheets, or read a sheet into a dataset. No Google login or expiring OAuth tokens: just share your sheet with our service account. Append, replace, dedupe, pick columns, flatten nested JSON.",
    "version": "0.1",
    "x-build-id": "HxPZSPmVHw1vGfYfQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/latentlark~sheets-export/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-latentlark-sheets-export",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/latentlark~sheets-export/runs": {
      "post": {
        "operationId": "runs-sync-latentlark-sheets-export",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/latentlark~sheets-export/run-sync": {
      "post": {
        "operationId": "run-sync-latentlark-sheets-export",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "spreadsheet"
        ],
        "properties": {
          "spreadsheet": {
            "title": "Google Sheet URL",
            "type": "string",
            "description": "URL (or ID) of your Google Sheet. Share the sheet with sheets-export@latentlark.iam.gserviceaccount.com as Editor first (Share button in Google Sheets). A #gid=... in the URL selects that tab. The prefilled URL is a read-only demo sheet with sample jobs: click Start to try a read, then replace it with your own sheet.",
            "default": "https://docs.google.com/spreadsheets/d/1x1XuD8S3BtAn7idKN8bLQ8UhNM-ucCQWqxD3l_CQ17k/edit#gid=1874420385"
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "append",
              "replace",
              "read"
            ],
            "type": "string",
            "description": "read: import the tab into this run's dataset (default, works with the demo sheet). append: add rows below existing data (header is created or extended). replace: clear the tab and write fresh.",
            "default": "read"
          },
          "datasetId": {
            "title": "Dataset to export",
            "type": "string",
            "description": "Apify dataset ID or name. In an integration (run after another Actor) use {{resource.defaultDatasetId}}."
          },
          "jsonData": {
            "title": "Or: JSON data",
            "type": "array",
            "description": "Rows to write directly, as a JSON array of objects. Used instead of the dataset when set."
          },
          "sheetName": {
            "title": "Tab name",
            "type": "string",
            "description": "Tab (worksheet) to use. Created automatically in append/replace mode if it doesn't exist. Empty = tab from the URL's #gid, else the first tab."
          },
          "columns": {
            "title": "Columns (select and order)",
            "type": "array",
            "description": "Only these columns, in this order. Use flattened names for nested fields, e.g. company.name. Empty = all columns.",
            "items": {
              "type": "string"
            }
          },
          "excludeColumns": {
            "title": "Exclude columns",
            "type": "array",
            "description": "Columns to leave out, e.g. description.",
            "items": {
              "type": "string"
            }
          },
          "dedupeBy": {
            "title": "Skip duplicates by column(s)",
            "type": "array",
            "description": "Rows whose value(s) in these columns already exist in the sheet (or earlier in this run) are skipped, e.g. url or id. Ideal for scheduled runs.",
            "items": {
              "type": "string"
            }
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "{\"company\": {\"name\": \"X\"}} becomes a column company.name.",
            "default": true
          },
          "arrayMode": {
            "title": "Arrays",
            "enum": [
              "join",
              "json",
              "expand"
            ],
            "type": "string",
            "description": "How to put arrays into cells.",
            "default": "join"
          },
          "flattenSeparator": {
            "title": "Nested column separator",
            "type": "string",
            "description": "Character(s) joining nested keys in column names, e.g. \".\" gives company.name.",
            "default": "."
          },
          "headerRow": {
            "title": "First row is the header",
            "type": "boolean",
            "description": "Read mode: use the first row as field names. Off: fields are named column1, column2, ...",
            "default": true
          },
          "parseValues": {
            "title": "Let Sheets parse values",
            "type": "boolean",
            "description": "Off (default, safe): values are stored exactly as text/numbers; formulas are not executed. On: Sheets parses dates, currencies and =formulas as if typed.",
            "default": false
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many rows (0 = no limit)."
          },
          "serviceAccountJson": {
            "title": "Your own service account key (optional)",
            "type": "string",
            "description": "Optional. Paste a Google service account JSON key to write as your own service account instead of ours (useful for org policies or high volume). Stored encrypted."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}