{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Import & Export (append, upsert, dedupe)",
    "description": "Export any Apify dataset to Google Sheets or read a sheet into a dataset. Append without overwriting, upsert by key, skip or remove duplicates, clear error messages and retries on Google limits. Uses your own service account.",
    "version": "1.0",
    "x-build-id": "oV4mcb21sMEmRmeLX"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/solidactors~google-sheets-import-export/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-solidactors-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/solidactors~google-sheets-import-export/runs": {
      "post": {
        "operationId": "runs-sync-solidactors-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/solidactors~google-sheets-import-export/run-sync": {
      "post": {
        "operationId": "run-sync-solidactors-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",
          "spreadsheetId"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "append",
              "replace",
              "upsert",
              "dedupe",
              "read"
            ],
            "type": "string",
            "description": "append: add rows under the existing ones. replace: overwrite the tab with the new data. upsert: update rows whose key already exists, add the rest. dedupe: remove duplicate rows already in the sheet. read: copy the sheet into the dataset of this run.",
            "default": "append"
          },
          "spreadsheetId": {
            "title": "Spreadsheet URL or ID",
            "type": "string",
            "description": "Paste the full Google Sheets URL or just the ID (the long part between /d/ and /edit). If the URL has #gid=..., that tab is used."
          },
          "sheetName": {
            "title": "Tab name",
            "type": "string",
            "description": "Name of the tab. It is created if it does not exist (write modes). Empty means the first tab."
          },
          "datasetId": {
            "title": "Dataset to export",
            "type": "string",
            "description": "The Apify dataset whose items go to the sheet. In an integration after another Actor, use {{resource.defaultDatasetId}}."
          },
          "rawData": {
            "title": "Or: JSON data",
            "type": "array",
            "description": "An array of JSON objects to write, used instead of (or together with) the dataset. Each object becomes a row; keys become columns."
          },
          "keyColumns": {
            "title": "Key column(s)",
            "type": "array",
            "description": "Column(s) that identify a row, for example url or id. Needed for upsert and for skip duplicates; optional for dedupe (empty means the whole row must match).",
            "items": {
              "type": "string"
            }
          },
          "skipDuplicates": {
            "title": "Append: skip rows whose key is already in the sheet",
            "type": "boolean",
            "description": "With mode append, rows whose key column(s) already exist in the sheet (or earlier in this run) are skipped instead of added again.",
            "default": false
          },
          "keyCaseInsensitive": {
            "title": "Keys ignore upper and lower case",
            "type": "boolean",
            "description": "Treat ABC and abc as the same key. Spaces at the start and end are always ignored.",
            "default": false
          },
          "columnsOrder": {
            "title": "Column order",
            "type": "array",
            "description": "Columns to put first, in this order. Other columns follow in the order they appear in the data.",
            "items": {
              "type": "string"
            }
          },
          "columnsToExclude": {
            "title": "Columns to leave out",
            "type": "array",
            "description": "Column names (after flattening, for example address/city) that are not written.",
            "items": {
              "type": "string"
            }
          },
          "flattenNested": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "On: an object address with a field city becomes a column address/city, like the Apify CSV export. Off: nested values are written as JSON text.",
            "default": true
          },
          "parseValues": {
            "title": "Let Google parse values (formulas, dates)",
            "type": "boolean",
            "description": "Off (safe default): values are written exactly as they are, text starting with = stays text. On: Google parses them as if typed by hand, so =SUM(...) becomes a formula and 2026-01-31 a date.",
            "default": false
          },
          "trimEmptyGrid": {
            "title": "Remove empty rows at the bottom of the tab",
            "type": "boolean",
            "description": "Google counts empty cells towards the 10 million cell limit. On: the tab is shrunk to the data after writing.",
            "default": true
          },
          "skipEmptyRows": {
            "title": "Read: skip empty rows",
            "type": "boolean",
            "description": "In read mode, rows with no values are not pushed to the dataset.",
            "default": true
          },
          "serviceAccountJson": {
            "title": "Service account key (JSON)",
            "type": "string",
            "description": "Paste the whole .json key of a Google Cloud service account, then share the spreadsheet with that service account e-mail as Editor. Step by step in the README (5 minutes, free)."
          },
          "oauthClientId": {
            "title": "Or OAuth: client ID",
            "type": "string",
            "description": "Optional alternative to the service account: the OAuth client ID of your own Google Cloud app."
          },
          "oauthClientSecret": {
            "title": "OAuth: client secret",
            "type": "string",
            "description": "The OAuth client secret of the same app."
          },
          "oauthRefreshToken": {
            "title": "OAuth: refresh token",
            "type": "string",
            "description": "A refresh token with the https://www.googleapis.com/auth/spreadsheets scope, made with your own OAuth client (for example in the Google OAuth Playground)."
          },
          "batchSize": {
            "title": "Rows per request",
            "minimum": 100,
            "maximum": 20000,
            "type": "integer",
            "description": "Rows sent to Google in one request (100 to 20,000). Requests are also cut at about 8 MB.",
            "default": 5000
          },
          "datasetOffset": {
            "title": "Dataset: skip the first N items",
            "minimum": 0,
            "type": "integer",
            "description": "Start reading the dataset at this item.",
            "default": 0
          },
          "datasetLimit": {
            "title": "Limit rows",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum rows taken from the dataset (write modes) or read from the sheet (read mode). Empty means all."
          },
          "dryRun": {
            "title": "Dry run (check only, write nothing)",
            "type": "boolean",
            "description": "Checks access, the tab, the keys and the cell limit, and reports what would happen, without changing the sheet.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}