{
  "name": "Google Maps reviews to Google Sheets sync using SerpApi",
  "nodes": [
    {
      "id": "0deb227f-1199-4aef-ac8e-a4db53985e77",
      "name": "If - Local or Place Results",
      "type": "n8n-nodes-base.if",
      "position": [
        4060,
        1540
      ]
    },
    {
      "id": "867b0ef5-cb51-468e-a4a9-957b2809a589",
      "name": "Split Local Results",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        4340,
        1780
      ]
    },
    {
      "id": "cdd460e6-2fbc-446f-bae5-2759e31ce68f",
      "name": "Loop Over Places",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        4600,
        1780
      ]
    },
    {
      "id": "2dfe9fa5-981c-4842-b100-d8e163961baa",
      "name": "Search Google Maps",
      "type": "n8n-nodes-serpapi.serpApi",
      "position": [
        3820,
        1540
      ]
    },
    {
      "id": "72e14880-b142-4afc-bb2d-faa88584c915",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4300,
        1780
      ],
      "parameters": {
        "width": 500,
        "height": 320,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Loop Over Each Place \n\nSplits out places in the `local_results` array and loops over each."
      }
    },
    {
      "id": "7221f8cd-722a-4036-9431-8528268ce6fb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3780,
        1140
      ],
      "parameters": {
        "width": 420,
        "height": 560,
        "content": "## Find places on Google Maps\n\n**Important** Update the \"Search Google Maps\" node to set your own Google Maps query in the \"Search Query\" field.\n\nThe If node here checks whether the Google Maps result"
      }
    },
    {
      "id": "a3554de2-cf47-4364-9e01-48c80cdf09ca",
      "name": "Update Review Count & Next Page Token",
      "type": "n8n-nodes-base.code",
      "position": [
        5600,
        1440
      ]
    },
    {
      "id": "9c1b7cd3-b528-4163-a686-f3ad4dd96373",
      "name": "Set num for Pagination",
      "type": "n8n-nodes-base.code",
      "position": [
        6140,
        1240
      ]
    },
    {
      "id": "45bfe23c-41f0-4596-8295-9ce4bc42c27e",
      "name": "Route Next Step",
      "type": "n8n-nodes-base.switch",
      "position": [
        5860,
        1440
      ]
    },
    {
      "id": "30a54c94-1826-4412-a2cb-5e07b0eeeee7",
      "name": "Append Reviews",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5320,
        1440
      ]
    },
    {
      "id": "5e1afade-a5ef-4232-a8dc-3afb7a971f28",
      "name": "Split Reviews",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        5080,
        1440
      ]
    },
    {
      "id": "4e1aedd8-c4e5-44a0-a28a-7752f16cfb0e",
      "name": "If Reviews Present",
      "type": "n8n-nodes-base.if",
      "position": [
        4840,
        1460
      ]
    },
    {
      "id": "d4ab1a92-1492-4a89-8c9b-86edcbd3ea72",
      "name": "Get Reviews",
      "type": "n8n-nodes-serpapi.serpApi",
      "position": [
        4580,
        1460
      ]
    },
    {
      "id": "5926cd59-f490-4d42-9832-c2f05a3ea4c5",
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        3360,
        1540
      ]
    },
    {
      "id": "3eff82f5-e399-40f8-8b46-b383f22287d3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4240,
        1140
      ],
      "parameters": {
        "width": 260,
        "height": 560,
        "content": "## Initialize Variables\n\nThis node initializes several variables to faciliate the workflow.\n\nDo not update this code unless you have a particular need and know what you're doing."
      }
    },
    {
      "id": "751033b8-2f34-4f57-be82-c91633ed143b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4540,
        1140
      ],
      "parameters": {
        "width": 440,
        "height": 480,
        "content": "## Get Reviews\n\nFetches a page of reviews. If it's the first page, `num` and `next_page_token` are null. Subsequent pages will includes these.\n\nIf there are no reviews in the response and there are mu"
      }
    },
    {
      "id": "0ded93ff-5973-42d8-a1d1-0e4132c47ac8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5020,
        1140
      ],
      "parameters": {
        "width": 440,
        "height": 480,
        "content": "## Add Reviews to Google Sheet\n\nAppends batch of reviews to Google Sheet. In case the settings get wiped when you add your Google Sheet, here is how everything should be set. They must be 'Expressions"
      }
    },
    {
      "id": "1ed58029-fec3-496d-bc0b-3444ff1fea29",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5500,
        1140
      ],
      "parameters": {
        "width": 800,
        "height": 480,
        "content": "## Route Next Step\n\nFirst code node increments `count` of reviews fetched already and sets `next_page_token`.\n\nSwitch node routes as follows:\n* If more pages to fetch->Get More Pages\n* If single place"
      }
    },
    {
      "id": "b413476d-dd5a-46b4-aa80-ebbf1e094b79",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2660,
        1080
      ],
      "parameters": {
        "width": 660,
        "height": 1100,
        "content": "## Sync Google Maps Reviews to Google Sheets for Any Google Maps Query\n\n### How it works\n\nThis workflow accepts any query you might run on actual Google Maps to search for places. The search happens t"
      }
    },
    {
      "id": "a1de7c43-2b8d-48bb-8554-30d76dfe3207",
      "name": "Set Review Limit",
      "type": "n8n-nodes-base.set",
      "position": [
        3580,
        1540
      ]
    },
    {
      "id": "e13ab771-0cce-427c-826b-2e8a83bbfd9a",
      "name": "Initialize Vars",
      "type": "n8n-nodes-base.code",
      "position": [
        4320,
        1460
      ]
    },
    {
      "id": "7291f010-f211-474c-a5be-c7b2f55f9486",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3500,
        1140
      ],
      "parameters": {
        "width": 260,
        "height": 560,
        "content": "## Update Review Limit\n\nYou can update the review limit here to customize the maximum reviews to fetch per place. Default limit is 50 reviews per place."
      }
    }
  ],
  "connections": {
    "Get Reviews": {
      "main": [
        [
          {
            "node": "If Reviews Present",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Reviews": {
      "main": [
        [
          {
            "node": "Append Reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Reviews": {
      "main": [
        [
          {
            "node": "Update Review Count & Next Page Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Vars": {
      "main": [
        [
          {
            "node": "Get Reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Next Step": {
      "main": [
        [
          {
            "node": "Set num for Pagination",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [
          {
            "node": "Loop Over Places",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Set Review Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Places": {
      "main": [
        [],
        [
          {
            "node": "Initialize Vars",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Review Limit": {
      "main": [
        [
          {
            "node": "Search Google Maps",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Reviews Present": {
      "main": [
        [
          {
            "node": "Split Reviews",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Places",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Google Maps": {
      "main": [
        [
          {
            "node": "If - Local or Place Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Local Results": {
      "main": [
        [
          {
            "node": "Loop Over Places",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set num for Pagination": {
      "main": [
        [
          {
            "node": "Get Reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If - Local or Place Results": {
      "main": [
        [
          {
            "node": "Initialize Vars",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Split Local Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Review Count & Next Page Token": {
      "main": [
        [
          {
            "node": "Route Next Step",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}