{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Import & Export — No OAuth, No Token Expiry",
    "description": "Export any Apify dataset to Google Sheets, or read a sheet into a dataset. Authenticates with a Google service account — a 2-minute one-time setup that never expires, never needs re-consent, and never breaks mid-schedule. Built for scheduled scraper-to-sheet pipelines.",
    "version": "0.0",
    "x-build-id": "HcNVmpffbSHcVmyAx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kaz_kakyo~google-sheets/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kaz_kakyo-google-sheets",
        "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/kaz_kakyo~google-sheets/runs": {
      "post": {
        "operationId": "runs-sync-kaz_kakyo-google-sheets",
        "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/kaz_kakyo~google-sheets/run-sync": {
      "post": {
        "operationId": "run-sync-kaz_kakyo-google-sheets",
        "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": [
          "mode",
          "spreadsheet"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "dataset-to-sheet",
              "json-to-sheet",
              "sheet-to-dataset"
            ],
            "type": "string",
            "description": "`dataset-to-sheet` writes an Apify dataset to a sheet; `json-to-sheet` writes rows you pass directly; `sheet-to-dataset` reads a sheet into this run's dataset.",
            "default": "dataset-to-sheet"
          },
          "serviceAccountKey": {
            "title": "Service account key (optional — cheaper)",
            "type": "string",
            "description": "Leave empty for zero setup: just share your spreadsheet (Editor) with sheets-only@telehealth-mr.iam.gserviceaccount.com, and rows are billed at the standard rate. Or bring your own service account for the discounted rate and full custody: console.cloud.google.com → IAM & Admin → Service Accounts → Create → Keys → Add key (JSON), enable the Sheets API, share your sheet with its email, paste the JSON here. Either way there is no OAuth and nothing expires. Stored encrypted, sent only to Google."
          },
          "spreadsheet": {
            "title": "Spreadsheet URL or ID",
            "type": "string",
            "description": "Full URL (https://docs.google.com/spreadsheets/d/...) or the bare spreadsheet ID."
          },
          "sheetName": {
            "title": "Sheet tab name",
            "type": "string",
            "description": "Tab to write to / read from. Defaults to the first tab. Created automatically when writing to a tab that doesn't exist."
          },
          "datasetId": {
            "title": "Dataset ID (dataset → sheet)",
            "type": "string",
            "description": "ID of the Apify dataset to export, e.g. the default dataset of a scraper run. Tip: trigger this actor from a webhook/integration on run success and pass `{{resource.defaultDatasetId}}`."
          },
          "datasetView": {
            "title": "Dataset view",
            "type": "string",
            "description": "Optional dataset view name (from the source actor's output schema) to apply field selection/ordering."
          },
          "rows": {
            "title": "Rows (JSON → sheet)",
            "type": "array",
            "description": "`json-to-sheet`: array of JSON objects to write."
          },
          "columns": {
            "title": "Columns",
            "type": "array",
            "description": "Optional explicit column order (flattened keys, e.g. `address.postcode`). Empty = auto from data, first-seen order.",
            "items": {
              "type": "string"
            }
          },
          "append": {
            "title": "Append instead of replace",
            "type": "boolean",
            "description": "ON: add rows below existing data (header written only if the sheet is empty). OFF: clear the tab and write fresh — right for scheduled snapshots.",
            "default": false
          },
          "range": {
            "title": "Range (sheet → dataset)",
            "type": "string",
            "description": "Optional A1 range to read, e.g. `A1:F100`. Defaults to the whole tab. First row is treated as the header."
          },
          "valueInputOption": {
            "title": "Value interpretation",
            "enum": [
              "RAW",
              "USER_ENTERED"
            ],
            "type": "string",
            "description": "`RAW` writes values as-is (safe default); `USER_ENTERED` lets Sheets parse numbers and dates as if typed by hand. In `USER_ENTERED` mode, formula-shaped values (starting with `=`, `+`, `-`, `@`) are escaped to plain text so exported data can never execute as formulas — enable \"Allow formulas\" only if you trust every value.",
            "default": "RAW"
          },
          "allowFormulas": {
            "title": "Allow formulas (USER_ENTERED)",
            "type": "boolean",
            "description": "DANGEROUS with scraped or third-party data: lets values like `=IMPORTXML(...)` execute as live formulas in your spreadsheet, which can leak sheet contents to external URLs. Leave OFF unless you generated every value yourself.",
            "default": false
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 500000,
            "type": "integer",
            "description": "Cap on rows written or read per run. Keeps cost predictable.",
            "default": 100000
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}