{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Export & Import (Reliable, No OAuth)",
    "description": "Send any Apify dataset, run or JSON to Google Sheets, or read a sheet back into a dataset. Service-account auth that never expires, automatic retries on Google rate limits, append / replace / de-duplicate modes.",
    "version": "1.0",
    "x-build-id": "qXtGe6OfWaRZUqXew"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sharkinho~google-sheets-sync/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sharkinho-google-sheets-sync",
        "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/sharkinho~google-sheets-sync/runs": {
      "post": {
        "operationId": "runs-sync-sharkinho-google-sheets-sync",
        "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/sharkinho~google-sheets-sync/run-sync": {
      "post": {
        "operationId": "run-sync-sharkinho-google-sheets-sync",
        "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": "Spreadsheet URL or ID",
            "type": "string",
            "description": "The Google Sheets URL (or just its ID). Share the spreadsheet with your service account email as Editor. Leave empty together with the key to try the public demo."
          },
          "sheetName": {
            "title": "Sheet (tab) name",
            "type": "string",
            "description": "Tab to write to / read from. Created automatically if it does not exist. Default: first tab."
          },
          "serviceAccountKey": {
            "title": "Service account JSON key",
            "type": "string",
            "description": "Full JSON key of a Google service account (stored encrypted). See the README for the 2-minute setup. Leave empty to run the demo."
          },
          "operation": {
            "title": "Operation",
            "enum": [
              "write",
              "read"
            ],
            "type": "string",
            "description": "write: send data to the sheet. read: load the sheet into this run's dataset.",
            "default": "write"
          },
          "mode": {
            "title": "Write mode",
            "enum": [
              "append",
              "replace",
              "append-unique"
            ],
            "type": "string",
            "description": "append: add rows below existing data (new columns are added to the right). replace: clear the tab first. append-unique: append only rows whose unique key is not already in the sheet.",
            "default": "append"
          },
          "uniqueKey": {
            "title": "Unique key column (for append-unique)",
            "type": "string",
            "description": "Field that identifies a row, e.g. url or id. Required for append-unique."
          },
          "datasetId": {
            "title": "Dataset",
            "type": "string",
            "description": "Apify dataset to export. Pick one of your datasets or paste its ID. To export every run of another Actor automatically, add this Actor as an integration and set this field to {{resource.defaultDatasetId}}."
          },
          "jsonUrl": {
            "title": "JSON URL",
            "type": "string",
            "description": "URL returning a JSON array (or an object with items/data array)."
          },
          "data": {
            "title": "Inline JSON data",
            "type": "array",
            "description": "Array of objects to write."
          },
          "range": {
            "title": "Range (for read)",
            "type": "string",
            "description": "A1 range to read, e.g. A1:F500. First row must be the header. Default: whole tab."
          },
          "fields": {
            "title": "Columns to include (in order)",
            "type": "array",
            "description": "Only these fields, in this order. Use dot notation for nested fields (seller.name). Empty = all fields.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Columns to omit",
            "type": "array",
            "description": "Fields to leave out of the sheet, e.g. html or images. Use dot notation for nested fields (seller.id).",
            "items": {
              "type": "string"
            }
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn {seller: {name}} into a column seller.name. Arrays of plain values are joined with commas.",
            "default": true
          },
          "parseValues": {
            "title": "Let Sheets parse values (formulas, dates)",
            "type": "boolean",
            "description": "Off (default) writes values exactly as they are, which protects against formula injection from scraped text. On = values are parsed as if typed by a user.",
            "default": false
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 0,
            "type": "integer",
            "description": "Limit the number of rows written or read. 0 = no limit.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}