{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset to Google Sheets Export",
    "description": "Send any Apify dataset to a Google Sheet. Append, replace, or append only new rows (dedupe by key). Runs after any scraper as an integration. Uses your own Google service account, so no shared quota, and every setup mistake gets a plain-English fix.",
    "version": "0.3",
    "x-build-id": "Vgf0V2tAjMDENYbXv"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/oldjard~dataset-to-google-sheets/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-oldjard-dataset-to-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/oldjard~dataset-to-google-sheets/runs": {
      "post": {
        "operationId": "runs-sync-oldjard-dataset-to-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/oldjard~dataset-to-google-sheets/run-sync": {
      "post": {
        "operationId": "run-sync-oldjard-dataset-to-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": [
          "spreadsheet",
          "serviceAccountKey"
        ],
        "properties": {
          "spreadsheet": {
            "title": "Google Sheet URL",
            "type": "string",
            "description": "Open the sheet in your browser and copy the address bar (https://docs.google.com/spreadsheets/d/.../edit). The spreadsheet ID alone also works. If the URL ends in #gid=..., that tab is used unless you name one below."
          },
          "serviceAccountKey": {
            "title": "Google service account key (JSON)",
            "type": "string",
            "description": "Paste the whole JSON key file of a Google service account. It is stored encrypted and never shown in logs. Then share your sheet with the service account's email (the \"client_email\" in the file) as an Editor. The README's 5-minute setup shows every click."
          },
          "datasetId": {
            "title": "Dataset",
            "type": "string",
            "description": "The dataset to export. Pick it from the list or paste its ID. When this runs as an integration after another Actor, this holds {{resource.defaultDatasetId}}, which Apify replaces with the finished run's dataset. Keep it."
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "append",
              "replace",
              "dedupe"
            ],
            "type": "string",
            "description": "Append: add rows under what's already in the tab. Replace: clear the tab, then write (an empty dataset leaves the tab untouched). Append only new rows: skip items whose key fields match a row already in the tab, for daily runs without duplicates.",
            "default": "append"
          },
          "dedupeFields": {
            "title": "Deduplicate by fields",
            "type": "array",
            "description": "For 'Append only new rows': the field(s) that identify an item, e.g. url or id. Several fields form one combined key. Nested fields use a slash: address/city.",
            "items": {
              "type": "string"
            }
          },
          "sheetName": {
            "title": "Tab name",
            "type": "string",
            "description": "Which tab to write to. Empty means the tab in the URL's #gid, or else the first tab."
          },
          "createSheet": {
            "title": "Create the tab if missing",
            "type": "boolean",
            "description": "Create a tab with that name when the spreadsheet has none.",
            "default": true
          },
          "fields": {
            "title": "Fields to export",
            "type": "array",
            "description": "Export only these fields, in this order. Naming a parent (address) takes all its nested columns (address/city, address/zip). Empty exports every field. Columns already in the tab keep their place either way.",
            "items": {
              "type": "string"
            }
          },
          "excludeFields": {
            "title": "Fields to leave out",
            "type": "array",
            "description": "Never export these fields (or anything nested under them).",
            "items": {
              "type": "string"
            }
          },
          "writeHeader": {
            "title": "Write header row",
            "type": "boolean",
            "description": "Keep field names in row 1. New fields are added as new columns on the right. Needed for 'Append only new rows' and for matching columns by name on later runs.",
            "default": true
          },
          "arrays": {
            "title": "Lists (arrays)",
            "enum": [
              "join",
              "columns",
              "json"
            ],
            "type": "string",
            "description": "Join: a list of plain values becomes one cell (a, b, c); lists of objects become JSON text. Columns: one column per element, like Apify's CSV export (tags/0, tags/1). JSON: the whole list as JSON text.",
            "default": "join"
          },
          "arraySeparator": {
            "title": "Separator for joined lists",
            "type": "string",
            "description": "Put between values when lists are joined into one cell.",
            "default": ", "
          },
          "objects": {
            "title": "Nested objects",
            "enum": [
              "columns",
              "json"
            ],
            "type": "string",
            "description": "Columns: one column per nested field (address/city). JSON: the whole object as JSON text in one cell.",
            "default": "columns"
          },
          "offset": {
            "title": "Skip first items",
            "minimum": 0,
            "type": "integer",
            "description": "Start from this item of the dataset.",
            "default": 0
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "type": "integer",
            "description": "Export at most this many items. Empty means all."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}