{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Import & Export (Service Account)",
    "description": "Reliable Google Sheets export/import for Apify datasets. Service-account auth: no OAuth flow, no expiring tokens. Replace, append, or upsert rows; import sheet ranges as typed datasets.",
    "version": "0.1",
    "x-build-id": "1MzSpXj7LFMoUKPVb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bridgeworks~sheets-bridge/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bridgeworks-sheets-bridge",
        "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/bridgeworks~sheets-bridge/runs": {
      "post": {
        "operationId": "runs-sync-bridgeworks-sheets-bridge",
        "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/bridgeworks~sheets-bridge/run-sync": {
      "post": {
        "operationId": "run-sync-bridgeworks-sheets-bridge",
        "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": [
          "spreadsheetId"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "export",
              "import"
            ],
            "type": "string",
            "description": "<b>export</b> writes an Apify dataset to a Google Sheet. <b>import</b> reads a sheet range into a new Apify dataset.",
            "default": "export"
          },
          "serviceAccountJson": {
            "title": "Service account JSON key",
            "type": "string",
            "description": "Paste the <b>entire</b> JSON key file of a Google service account (starts with <code>{\"type\": \"service_account\", ...}</code>). Then share your spreadsheet with the service account's <code>client_email</code> as <b>Editor</b>. Stored encrypted; never logged. Required for every real run — it is only optional so that <b>Test mode</b> works without any Google setup; a real run without it fails immediately with the 3-step setup guide from the README (about 2 minutes, no OAuth, nothing ever expires)."
          },
          "spreadsheetId": {
            "title": "Spreadsheet",
            "type": "string",
            "description": "The spreadsheet URL (just paste it from your browser) or the spreadsheet ID (the long string between <code>/spreadsheets/d/</code> and <code>/edit</code>)."
          },
          "sheetName": {
            "title": "Sheet tab name",
            "type": "string",
            "description": "The tab to write to or read from. On export the tab is created automatically if it does not exist. Case-sensitive.",
            "default": "Sheet1"
          },
          "datasetId": {
            "title": "Dataset ID (export)",
            "type": "string",
            "description": "The Apify dataset to export. Leave empty to use the run's default dataset — that is what you want when this Actor runs as an integration on another Actor's finished run."
          },
          "exportMode": {
            "title": "Export mode",
            "enum": [
              "replace",
              "append",
              "upsert"
            ],
            "type": "string",
            "description": "<b>replace</b> clears the tab and writes everything fresh. <b>append</b> adds rows below existing data (new columns are merged into the header). <b>upsert</b> matches rows on the key column: existing rows are updated in place, new ones appended, unchanged ones skipped.",
            "default": "replace"
          },
          "keyColumn": {
            "title": "Key column (for upsert)",
            "type": "string",
            "description": "The field that uniquely identifies a row, e.g. <code>id</code>, <code>url</code>, or a flattened path like <code>user.email</code>. Required when Export mode = upsert."
          },
          "valueInputOption": {
            "title": "Value interpretation",
            "enum": [
              "USER_ENTERED",
              "RAW"
            ],
            "type": "string",
            "description": "<b>USER_ENTERED</b>: Sheets parses values as if typed by a user (numbers, dates). For safety, cells starting with <code>=</code>, <code>+</code> or <code>@</code> are escaped to literal text so scraped content can never execute as a formula in your sheet. <b>RAW</b>: values are stored exactly as sent, no parsing.",
            "default": "USER_ENTERED"
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 1,
            "type": "integer",
            "description": "Optional cap on the number of dataset items exported. Leave empty for all."
          },
          "rows": {
            "title": "Raw rows (instead of a dataset)",
            "type": "array",
            "description": "Advanced: a JSON array of objects to export directly, bypassing datasets. Handy for quick tests and for calling this Actor from code."
          },
          "range": {
            "title": "Range (import)",
            "type": "string",
            "description": "A1 range to read, e.g. <code>A1:F100</code> or <code>A2:D</code>. Leave empty to read the whole tab."
          },
          "headerRow": {
            "title": "First row is a header",
            "type": "boolean",
            "description": "When on, the first row of the range provides the field names of the dataset items. When off, fields are named column_1, column_2, ...",
            "default": true
          },
          "skipEmptyRows": {
            "title": "Skip empty rows",
            "type": "boolean",
            "description": "Rows where every cell is empty are not imported.",
            "default": true
          },
          "valueRender": {
            "title": "Cell value type",
            "enum": [
              "typed",
              "formatted"
            ],
            "type": "string",
            "description": "<b>typed</b>: numbers and booleans arrive as real types (recommended for automation). <b>formatted</b>: values arrive as the strings you see in the sheet (currency symbols, date formats).",
            "default": "typed"
          },
          "resultDatasetIdOrName": {
            "title": "Result dataset name (import)",
            "type": "string",
            "description": "Optional named dataset to push imported rows into. Leave empty to use the run's default dataset."
          },
          "testMode": {
            "title": "Test mode (no Google calls)",
            "type": "boolean",
            "description": "Runs the full pipeline against an in-memory fake Sheets API. No credentials needed, nothing written to Google. For trying the Actor out and for CI.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}