{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Reader & Writer",
    "description": "Read any Google Sheet to JSON or write rows to a sheet — via Service Account auth. No OAuth blocking, no failed logins. Supports read, append, replace, modify, and backup modes. Includes safe replace, dry run, auto-create tab, and rate limit retry.",
    "version": "0.1",
    "x-build-id": "7Xr6Hfx2JUPSSpU5a"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/accurate_pouch~google-sheets-rw/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-accurate_pouch-google-sheets-rw",
        "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/accurate_pouch~google-sheets-rw/runs": {
      "post": {
        "operationId": "runs-sync-accurate_pouch-google-sheets-rw",
        "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/accurate_pouch~google-sheets-rw/run-sync": {
      "post": {
        "operationId": "run-sync-accurate_pouch-google-sheets-rw",
        "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"
        ],
        "properties": {
          "spreadsheetId": {
            "title": "Spreadsheet ID",
            "type": "string",
            "description": "ID from your Google Sheet URL (between /d/ and /edit). Required unless using 'spreadsheets' for multiple sheets."
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "read",
              "append",
              "replace",
              "modify",
              "loadBackup"
            ],
            "type": "string",
            "description": "read: export sheet to JSON. append: add rows. replace: overwrite sheet. modify: transform existing data. loadBackup: restore a backup.",
            "default": "read"
          },
          "range": {
            "title": "Sheet / Range",
            "type": "string",
            "description": "Tab name or A1 range. Examples: Sheet1, Sheet2!A1:D100. Default: first sheet."
          },
          "serviceAccountKey": {
            "title": "Service Account Key (JSON)",
            "type": "string",
            "description": "Required for private sheets and all write operations. Paste the full contents of your Google Service Account JSON key file. See README for 5-minute setup guide."
          },
          "publicSpreadsheet": {
            "title": "Public Spreadsheet (no auth)",
            "type": "boolean",
            "description": "Set true to read a publicly shared sheet without a Service Account key. Read-only. Sheet must be shared as 'Anyone with the link'.",
            "default": false
          },
          "rows": {
            "title": "Rows to Write",
            "type": "array",
            "description": "Array of objects for append/replace modes. Keys must match column headers. Used when you are not pulling from an Apify dataset."
          },
          "datasetId": {
            "title": "Dataset ID",
            "type": "string",
            "description": "Apify dataset ID to import data from. Use this to chain this actor after a scraper."
          },
          "rawData": {
            "title": "Raw Data",
            "type": "array",
            "description": "Array of objects or array of arrays (first row = headers). Max 9MB."
          },
          "limit": {
            "title": "Dataset Limit",
            "type": "integer",
            "description": "Max rows to pull from dataset. Default: 250000.",
            "default": 250000
          },
          "offset": {
            "title": "Dataset Offset",
            "type": "integer",
            "description": "Skip this many rows from the start of the dataset.",
            "default": 0
          },
          "deduplicateByField": {
            "title": "Deduplicate by Field",
            "type": "string",
            "description": "Field name to deduplicate by. Rows with duplicate values in this field are skipped. Cannot be used with deduplicateByEquality or transformFunction."
          },
          "deduplicateByEquality": {
            "title": "Deduplicate by Equality",
            "type": "boolean",
            "description": "Skip rows that are identical across all fields. Cannot be used with deduplicateByField or transformFunction.",
            "default": false
          },
          "transformFunction": {
            "title": "Transform Function",
            "type": "string",
            "description": "Custom JS function: ({ spreadsheetData, datasetData }) => [...]. Receives existing sheet data and new data, returns final array to write. Cannot be used with deduplication."
          },
          "columnsOrder": {
            "title": "Columns Order",
            "type": "array",
            "description": "Array of column keys. Listed keys appear first, remaining sorted alphabetically."
          },
          "keepSheetColumnOrder": {
            "title": "Keep Sheet Column Order",
            "type": "boolean",
            "description": "If true, preserves the existing column order from the sheet. Has no effect on an empty sheet.",
            "default": false
          },
          "headerRow": {
            "title": "Header Row Number",
            "minimum": 1,
            "type": "integer",
            "description": "Which row contains the column headers. Default: 1 (first row). Use if your sheet has title rows above the headers.",
            "default": 1
          },
          "skipEmptyRows": {
            "title": "Skip Empty Rows",
            "type": "boolean",
            "description": "Remove rows where all cells are blank before processing.",
            "default": false
          },
          "createBackup": {
            "title": "Create Backup",
            "type": "boolean",
            "description": "Save existing sheet data to key-value store before making changes. Restore with loadBackup mode.",
            "default": false
          },
          "backupStore": {
            "title": "Backup Store ID",
            "type": "string",
            "description": "Key-value store ID containing a backup to restore. Required for loadBackup mode."
          },
          "safeReplace": {
            "title": "Safe Replace",
            "type": "boolean",
            "description": "For replace mode: write to a temp tab first, verify, then swap. If the write fails, your original data is untouched. Highly recommended. Default: true.",
            "default": true
          },
          "dryRun": {
            "title": "Dry Run",
            "type": "boolean",
            "description": "Preview exactly what would be written without touching the sheet. No charges applied.",
            "default": false
          },
          "autoCreateTab": {
            "title": "Auto-Create Tab",
            "type": "boolean",
            "description": "If the specified sheet tab does not exist, create it automatically instead of failing. Default: true.",
            "default": true
          },
          "spreadsheets": {
            "title": "Multiple Spreadsheets",
            "type": "array",
            "description": "Process multiple spreadsheets in one run. Each item: { spreadsheetId, range }. Overrides the spreadsheetId field."
          },
          "maxConcurrency": {
            "title": "Max Concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Parallel spreadsheet operations when using multiple spreadsheets. Default: 3. Max: 10.",
            "default": 3
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}