{
  "name": "Export Google Maps Leads to Google Sheets on a Schedule",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "weeksInterval": 1
            }
          ]
        }
      },
      "id": "11111111-0000-0000-0000-000000000001",
      "name": "Weekly Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/captainhandsome~google-maps-business-search/runs",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\n  \"search_terms\": [\"commercial contractors in Dallas TX\", \"HVAC repair in Phoenix AZ\"],\n  \"max_items\": 50\n}",
        "options": {}
      },
      "id": "11111111-0000-0000-0000-000000000002",
      "name": "Start Google Maps Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "amount": 45,
        "unit": "seconds"
      },
      "id": "11111111-0000-0000-0000-000000000003",
      "name": "Wait for Scraping",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        700,
        300
      ]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://api.apify.com/v2/datasets/{{ $json.data.defaultDatasetId }}/items?clean=true&format=json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "id": "11111111-0000-0000-0000-000000000004",
      "name": "Fetch Clean Leads Dataset",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        920,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Leads",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        },
        "options": {}
      },
      "id": "11111111-0000-0000-0000-000000000005",
      "name": "Append to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [
        1140,
        300
      ]
    }
  ],
  "connections": {
    "Weekly Trigger": {
      "main": [
        [
          {
            "node": "Start Google Maps Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Google Maps Scraper": {
      "main": [
        [
          {
            "node": "Wait for Scraping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Scraping": {
      "main": [
        [
          {
            "node": "Fetch Clean Leads Dataset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Clean Leads Dataset": {
      "main": [
        [
          {
            "node": "Append to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateId": "apify-google-maps-to-sheets",
    "instanceId": "community-template",
    "description": "Automatically extract business leads (name, phone, address, rating, website) using captainhandsome/google-maps-business-search on Apify and append them to Google Sheets."
  }
}
