{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Import & Export: Append, No OAuth",
    "description": "Export an Apify dataset to Google Sheets (append under existing rows or replace a tab) or import a Google Sheet to JSON. Uses your own service account, so no OAuth sign-in; public sheets import with no key. Append keeps your column order. Rows that fail are never charged.",
    "version": "1.0",
    "x-build-id": "fWYwE6QZNZfeZzR1G"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/altronite~google-sheets-import-export/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-altronite-google-sheets-import-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/altronite~google-sheets-import-export/runs": {
      "post": {
        "operationId": "runs-sync-altronite-google-sheets-import-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/altronite~google-sheets-import-export/run-sync": {
      "post": {
        "operationId": "run-sync-altronite-google-sheets-import-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": [
          "mode",
          "spreadsheet"
        ],
        "properties": {
          "mode": {
            "title": "What to do",
            "enum": [
              "export",
              "import"
            ],
            "type": "string",
            "description": "Export copies a dataset into a sheet. Import reads a sheet into this run's dataset.",
            "default": "import"
          },
          "spreadsheet": {
            "title": "Spreadsheet URL or ID",
            "type": "string",
            "description": "Paste the sheet's URL from your browser, or just its ID. The prefilled value is Google's own public 'Class Data' sample sheet, so you can run this Actor with no setup to see how it works.",
            "default": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
          },
          "sheetName": {
            "title": "Tab name",
            "type": "string",
            "description": "The tab (worksheet) to use. On export it is created if it doesn't exist. On import, a tab name that doesn't exist stops the run with the list of the sheet's tabs (nothing is imported or charged); left at the default Sheet1, the first tab is used.",
            "default": "Sheet1"
          },
          "serviceAccountJson": {
            "title": "Service account key (JSON, optional for import)",
            "type": "string",
            "description": "Paste the full JSON key of a Google service account, then share your spreadsheet with that account's email as Editor (Viewer for import). Stored encrypted; never logged or saved to any dataset. See the README for a 2-minute setup. Export always needs a key. Import works without one if the sheet is shared as 'Anyone with the link can view'. The key file you download from Google Cloud contains \"type\": \"service_account\", a \"client_email\" and a \"private_key\"; paste the whole file."
          },
          "datasetId": {
            "title": "Dataset (export)",
            "type": "string",
            "description": "The dataset to copy into the sheet: pick one, or paste a dataset ID or name from another run."
          },
          "writeMode": {
            "title": "Write mode",
            "enum": [
              "append",
              "replace"
            ],
            "type": "string",
            "description": "Append adds rows under existing data and keeps your columns in place. Replace clears the tab first.",
            "default": "append"
          },
          "columns": {
            "title": "Columns (optional)",
            "type": "array",
            "description": "Export only these fields, in this order. Nested fields use dots, e.g. address.city. Leave empty for all fields.",
            "items": {
              "type": "string"
            }
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many rows (0 = no limit). Prefilled small so a first, key-less run finishes in seconds.",
            "default": 0
          },
          "skipEmptyRows": {
            "title": "Skip empty rows (import)",
            "type": "boolean",
            "description": "Ignore completely blank rows when importing.",
            "default": true
          },
          "dryRun": {
            "title": "Dry run",
            "type": "boolean",
            "description": "Open the sheet and report what would happen, without writing rows or charging for rows. The run start fee still applies. On export, a missing tab is still created.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}