{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Export & Sync: append, upsert, dedupe",
    "description": "Send any Apify dataset to a Google Sheet with your own service account (your own quota). Append, replace, upsert by key or add only new rows, with dedupe, column selection and renaming, nested JSON flattening, batching and automatic retries. Works as an integration after any Actor run.",
    "version": "1.0",
    "x-build-id": "tkR1gkhBFcLnpfXAg"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/arpitgoriya~google-sheets-export/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-arpitgoriya-google-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/arpitgoriya~google-sheets-export/runs": {
      "post": {
        "operationId": "runs-sync-arpitgoriya-google-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/arpitgoriya~google-sheets-export/run-sync": {
      "post": {
        "operationId": "run-sync-arpitgoriya-google-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",
        "properties": {
          "spreadsheet": {
            "title": "Google Sheet URL or ID",
            "type": "string",
            "description": "Copy the URL from your browser, e.g. https://docs.google.com/spreadsheets/d/1AbC…/edit#gid=0. The sheet must be shared with your service account's email as Editor (see the setup guide in the README)."
          },
          "serviceAccountKey": {
            "title": "Service account key (JSON)",
            "type": "string",
            "description": "Paste the whole content of the JSON key file of your Google Cloud service account (it contains \"client_email\" and \"private_key\"). Stored encrypted. Using your own key means your own Google quota: no shared-quota errors. Leave empty for a free dry run."
          },
          "sheetName": {
            "title": "Sheet (tab) name",
            "type": "string",
            "description": "Tab to write to. Created if it doesn't exist. Empty = the tab in the URL (#gid=…), otherwise the first tab."
          },
          "datasetId": {
            "title": "Dataset",
            "type": "string",
            "description": "The dataset to export. Leave empty when this Actor runs as an integration after another Actor (the run's dataset is passed automatically) or when you give a Run ID."
          },
          "runId": {
            "title": "Run ID",
            "type": "string",
            "description": "Alternative to Dataset: export the default dataset of this Actor run."
          },
          "offset": {
            "title": "Skip first N items",
            "minimum": 0,
            "type": "integer",
            "description": "Start reading the dataset at this position.",
            "default": 0
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 0,
            "type": "integer",
            "description": "Read at most this many dataset items (0 = all).",
            "default": 0
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "append",
              "replace",
              "upsert",
              "appendNew"
            ],
            "type": "string",
            "description": "How the data is written. Upsert and Append new only need Key columns.",
            "default": "append"
          },
          "keyColumns": {
            "title": "Key columns",
            "type": "array",
            "description": "Column(s) that identify a row, e.g. \"url\" or \"id\" (field name or the renamed header). Needed for Upsert and Append new only; also used by Remove duplicates.",
            "items": {
              "type": "string"
            }
          },
          "dedupe": {
            "title": "Remove duplicates in the data",
            "type": "boolean",
            "description": "Drop repeated rows from the dataset before writing (same key columns, or identical rows when no key is set). Upsert and Append new only always do this by key.",
            "default": false
          },
          "columns": {
            "title": "Columns",
            "type": "array",
            "description": "Only export these fields, in this order. Use dots for nested fields (\"price.amount\"); a parent (\"price\") includes all its sub-fields. Empty = all fields.",
            "items": {
              "type": "string"
            }
          },
          "excludeColumns": {
            "title": "Exclude columns",
            "type": "array",
            "description": "Fields to leave out (e.g. \"descriptionHtml\", \"debug\").",
            "items": {
              "type": "string"
            }
          },
          "columnNames": {
            "title": "Rename columns",
            "type": "object",
            "description": "Header names to use instead of field names, e.g. {\"price.amount\": \"Price\", \"url\": \"Link\"}."
          },
          "addNewColumns": {
            "title": "Add new columns",
            "type": "boolean",
            "description": "When the data has fields the sheet's header doesn't have yet, add them as new columns on the right. Off = keep the sheet's columns and skip the rest.",
            "default": true
          },
          "arrayMode": {
            "title": "Arrays",
            "enum": [
              "join",
              "json",
              "expand"
            ],
            "type": "string",
            "description": "How lists inside items are written. Nested objects are always flattened into dotted columns.",
            "default": "join"
          },
          "valueInputOption": {
            "title": "Cell values",
            "enum": [
              "RAW",
              "USER_ENTERED"
            ],
            "type": "string",
            "description": "Raw stores text exactly, so scraped text starting with \"=\" can never run as a formula. Use \"As if typed\" if you want Sheets to parse dates and formulas.",
            "default": "RAW"
          },
          "dryRun": {
            "title": "Dry run",
            "type": "boolean",
            "description": "Read the data (and the sheet, if a key is given) and report what would be written, without writing or charging anything.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}