How to Automate Google Maps Data Collection With n8n and ScrapeHero

Share:

Automate Google maps with n8n

You need to automate Google Maps data collection with n8n because manually searching Google Maps and copying results into a spreadsheet is slow and error-prone. In this tutorial, you’ll build an n8n workflow that reads search queries from a Google Sheet, retrieves Google Maps search results through ScrapeHero’s API, creates a dedicated worksheet for each query, and keeps the results updated over time.

The workflow uses:

  • n8n for workflow automation, pagination, looping, and conditional logic.
  • Google Sheets to store queries and maintain one results sheet per search query.
  • ScrapeHero’s Google Maps Search API to retrieve structured business-listing data.
  • Place ID as the unique identifier for appending new listings or updating existing ones.

ScrapeHero’s Google Maps scraper API for n8n returns listing data in a structured JSON response, including fields such as placeid, address, latitude, longitude, phone, website, url, rating, and reviews. 

What the Workflow Does

The workflow allows you to use a Google Maps scraper with n8n. It accepts one or more search queries from a Google Sheet named Queries. For each query, it calls ScrapeHero’s Google Maps Search API, handles pagination, creates a new Google Sheets worksheet named after the query, and writes each business listing into that worksheet. All using n8n nodes.

For example, if your Queries sheet contains:

Query
plumbers in Boston
dentists in New York

The workflow creates and maintains two worksheets:

  • plumbers in Boston
  • dentists in New York

On the first run, listings are appended to the newly created sheet. On subsequent runs, the workflow updates existing rows based on Place ID, so updated ratings, review counts, phone numbers, or websites do not create duplicate records. 

Before You Automate Google Maps Data Collection with n8n

Prepare the following:

  1. An n8n cloud account or self-hosted n8n instance.
  2. A Google account with access to Google Sheets.
  3. A Google Cloud OAuth2 credential.
  4. A ScrapeHero account and API key.
  5. A Google Spreadsheet containing your Google Maps search terms.

Google Sheets with queries in a column with the header Query

The workflow reads each query, retrieves matching Google Maps listings, and writes the results to a separate worksheet named after the query.

Google Maps Scraping with n8n Overview

The completed workflow follows this structure:

  1. Manual Trigger
  2. Get row(s) in sheet: Queries
  3. Loop Over Items
  4. HTTP Request: ScrapeHero Google Maps Search API
  5. Split Listings: listing_data
  6. Map Location Fields
  7. If node to check did “Create sheet” produce output?
    1. True → Append Rows
    2. False → Update row in sheet
  8. Back to Loop Over Items

The Create sheet node runs alongside the listing-processing branch. If it successfully creates a worksheet, the workflow knows the query is being run for the first time and appends rows. If it does not produce output, the worksheet already exists, so the workflow updates existing rows by Place ID. 

Don’t want to code? ScrapeHero Cloud is exactly what you need.

With ScrapeHero Cloud, you can download data in just two clicks!

Build the Workflow to Automate Google Maps Data Collection with n8n

1. Add a Manual Trigger

Create a new workflow in n8n.

n8n dashboard showing Create Workflow button with a red arrow pointing to it

Click the plus icon, and select “Trigger manually” in the right pane that pops up. This node lets you start the workflow manually whenever you want to refresh your Google Maps data.

Empty n8n canvas showing a plus icon in the center and Trigger manually option showing in the right panel

2. Read Queries from Google Sheets

Connect a Google Sheets node with Get row(s) in the sheet as the Sheet action.

Adding a Google sheet node with Get rows in sheet action

Configure it as follows:

  1. Document: Select your Google Spreadsheet, for example, GMaps Search API: Location Master Sheet.
  2. Sheet: Select your sheet inside the spreadsheet, for example, Queries.

Configuring the Google Sheet node to get rows from a sheet within a row

This node retrieves every row in the Queries worksheet. Each row should contain a Query value that the workflow will pass to ScrapeHero.

3. Add a Loop Over Items node

Connect a Loop Over Items node to the Get row(s) in sheet node.

Adding the Loop Over Items node to a Google sheet node in n8n

This node processes one query at a time. It is important because each query needs its own API request, its own worksheet, and its own append-or-update logic.

4. Call ScrapeHero’s Google Maps Search API

Connect an HTTP Request node on the loop branch of the Loop Over Items node.

Connecting an HTTP request node to the Loop Over Items node

Configure it as follows:

  • Method: GET
  • URL: https://get.scrapehero.com/api/google-map/search-results/
  • Authentication: Generic Credential Type → Query Auth
  • Query Parameter:
    • Name: input
    • Value: {{ $json.Query }}

The input parameter receives the current query from the Queries sheet. For example, if the current row contains plumbers in New York, the API request searches Google Maps for that term.

Setting up API endpoint and parameters in the HTTP request node

Configure ScrapeHero authentication

  1. Under Query Auth, click Connect to Query Auth
  2. Add your ScrapeHero API key using the key and value required by ScrapeHero’s API documentation.

Setting up API key in the HTTP request node

Storing the API key in an n8n credential keeps it out of the workflow canvas and makes it easier to rotate later.

5. Configure Pagination

Google Maps search results can span multiple pages. Configure pagination inside the HTTP Request node so n8n retrieves additional pages automatically.

In the HTTP Request node, open Options → Pagination and configure:

  • Pagination Mode: Update a Parameter in Each Request.
  • Parameter to Update:
    • Type: Query
    • Name: input
    • Value: {{ $response.body.next_page_url }}
  • Pagination Complete When: Receive Specific Status Code(s).
  • Status Codes When Complete: 400
  • Limit Pages Fetched: Enabled.
  • Max Requests: 4
  • Interval Between Requests: 1000 ms

This setup tells n8n to use the next_page_url returned by ScrapeHero for the following request. The workflow stops when the API returns status code 400, fetches at most four pages per query, and waits one second between requests to avoid sending requests too quickly.

6. Create a Worksheet for the Query

Add a Google Sheets node named Create Sheet.

Connecting a Google sheet node with Create sheet action

Configure it as follows:

  • Operation: Create Sheet.
  • Document: Select the same Google Spreadsheet used for the Queries worksheet.
  • Title: {{ $(‘Loop Over Items1’).item.json.Query }}

This creates a worksheet named after the current query. For example, a query of plumbers in New York creates a worksheet called plumbers in New York.

Configuring the Google sheet node with create sheet action

Connect the HTTP Request node to this Create sheet node as well as to the Split Listings node. The Create sheet node acts as the workflow’s signal for whether this is a first run or a refresh run.

7. Split the Listings into Individual Items

Add a Split Out node named Split Listings.

Connecting a Split Out Node to an HTTP request node

Configure:

  • Field to Split Out: listing_data

ScrapeHero’s response contains a listing_data array. The Split Out node converts that array into separate n8n items, allowing the workflow to process one business listing at a time.

Configuring Split Out node to separate individual Google Maps listings

Connect the HTTP Request node to Split Listings, and connect Create sheet to Split Listings as well.

8. Keep Only the Essential Fields

Add an Edit Fields node after the Split Out node.

Connecting Edit Fields node to the Split Out node

This node allows you to select the necessary fields from the ScrapeHero node’s output. Drag and drop them from the output of the Split node into the designated area.

  1. Place ID
  2. Address
  3. Latitude
  4. Longitude
  5. Phone
  6. Website
  7. Google Map URL
  8. Rating
  9. Rating Count

Configuring the Edit fields node to extract PlaceID, Address, Latitude, Longitude, Phone, Website, Google Maps URL

The Place ID column is important because it identifies each Google Maps listing and prevents duplicate rows.

9. Check Whether the Worksheet is New

Add an If node named If after the Edit fields node.

Connecting an If node to the Edit Fields node

Configure the condition as:

{{ $(‘Create sheet’).all().length > 0 }}

Set the condition to check whether the value is true.

Configuring If field to check if the create sheet node's output has a length greater than zero

This expression checks whether or not the Create sheet node returns an output. If it did, the worksheet was newly created and the listings should be appended. If it did not, the worksheet already existed and the listings should be updated.

10. Append Rows for a New Query

On the true branch of the If node, add a Google Sheets node named Append Rows.

Connecting a Google sheet node with Append Rows to the True branch of the If node

Configure it as follows:

  • Operation: Append or Update Row.
  • Document: Select the same Google Spreadsheet.
  • Sheet: {{ $(‘HTTP Request’).item.json.query.input }}
  • Mapping Column Mode: Map Automatically.

Configuring the Document and Sheet to be appended in the Google sheet node

Because this branch runs when the query worksheet has just been created, the listings are appended as new rows.  

11. Update Rows for an Existing Query

On the false branch of the If node, add a Google Sheets node named Update row in sheet.

Connecting a Google sheet node with the Update row in sheet action to the False branch of the If node

Configure it as follows:

  • Operation: Update Row.
  • Document: Select the same Google Spreadsheet.
  • Sheet: {{ $(‘HTTP Request’).item.json.query.input }}
  • Mapping Column Mode: Define Below.
  • Matching Column: Place ID.

Map the following fields:

  • Place ID 
  • Address 
  • Latitude 
  • Longitude 
  • Phone 
  • Website 
  • Google Maps URL 
  • Rating 
  • Review Count

Configuring the document and sheet to be updated in the Google sheet node

When you rerun the workflow, n8n finds the existing row with the same Place ID and updates its details. This keeps ratings, review counts, phone numbers, and websites current without creating duplicate rows.

12. Close the Loop

Connect the outputs of both Append Rows and Update row in sheet back to the input of Loop Over Items.

This allows n8n to process the next listing from the current query. Once all listings have been processed, the Loop Over Items node moves to the next query in the Queries worksheet.

A complete n8n workflow to create a location master sheet using ScrapeHero Cloud

Test the Workflow

Run a First Test

  1. Open your Google Spreadsheet and add a test query to the Queries sheet, such as plumbers in New York.
  2. In n8n, click Execute Workflow.
  3. Confirm that the Get row(s) in sheet node returns the query.
  4. Confirm that the HTTP Request node returns ScrapeHero’s Google Maps response.
  5. Check that the Create sheet node creates a worksheet named after the query.
  6. Verify that Split Listings creates one item per business.
  7. Check that Append Rows writes the mapped fields into the new worksheet.

Your new worksheet should contain columns such as Place ID, Address, Latitude, Longitude, Phone, Website, Google Maps URL, Rating, and Review Count.

Run the Workflow Again

Run the same workflow again without changing the query.

This time:

  • The Create sheet node should not create a new worksheet.
  • The If node should route listings to the Update row in the sheet branch.
  • Existing rows should be updated by Place ID.
  • New listings should be added if they appear in the latest API response.

Now the workflow to automate Google Maps data collection with n8n is complete: run it daily, weekly, or on whatever schedule fits your local SEO or lead-generation workflow.

How this Workflow Helps Your Business

  • Run faster local SEO audits. Track competitor names, addresses, phone numbers, websites, ratings, and review counts across target locations. Repeated runs make it easier to spot missing or inconsistent business information and monitor local visibility over time.
  • Support competitor research. Build a clean worksheet for each query so you can compare nearby competitors, identify high-rated businesses, and see which listings are actively maintaining their profiles.
  • Generate and qualify leads. Export structured business details, including phone numbers and websites, into a location database your sales or outreach team can use. Because the workflow updates records by Place ID, your lead list stays current and free of duplicate entries.
  • Monitor listing changes automatically. Ratings, review counts, phone numbers, and websites can change at any time. Rerunning the workflow updates existing rows, giving you a dependable view of the latest listing information.
  • Create a foundation for reporting. The Google Sheets output can feed dashboards in Looker Studio, Power BI, or another BI tool. That makes it easier to visualize location coverage, review trends, competitor density, and changes across multiple markets.
  • Scale without adding manual work. Add new search queries to the Queries sheet, and the workflow creates and maintains a separate worksheet for each one. Whether you monitor ten locations or hundreds, the process remains consistent.

Best Practices

  • Keep one worksheet per query to make historical comparisons and dashboards easier.
  • Use Place ID as the canonical identifier for every business.
  • Set a sensible pagination limit to control API usage and prevent unexpectedly large runs.
  • Do not hardcode API keys in node parameters; store them in n8n credentials.
  • Test with a single query before adding multiple queries to the Queries sheet.

Ways to Extend the Workflow

Once the base workflow is working, you can extend it to:

  • Send a Slack, email, or Telegram alert when a new business appears.
  • Track changes in rating or review count over time.
  • Add a Last Updated timestamp column.
  • Filter listings by minimum rating, review count, or location.
  • Feed the Google Sheets data into Looker Studio, Power BI, or another dashboard tool.
  • Schedule the workflow in n8n so Google Maps data refreshes automatically.

With this setup, you can turn Google Maps search results into a structured, refreshable location database—without manually copying listings into spreadsheets.

Wrapping Up

Manually searching Google Maps and building a location database row by row is slow, repetitive, and difficult to maintain. Using ScrapeHero’s Google Maps Search API, you can automate Google Maps data collection with n8n, organize results by search query, and keep your business-listing data up to date.

ScrapeHero handles the data extraction, while n8n manages the workflow logic—from reading search queries and handling pagination to creating worksheets and updating records. This lets your team spend less time copying data and more time using it for local SEO, competitor analysis, lead generation, and location monitoring.

Sign up for a ScrapeHero API key to start building your Google Maps data workflow. Need additional data points or a custom output format? Share your requirements, and we can build a custom API for your use case.

ScrapeHero is a full-service web scraping provider that combines automated data extraction with human-in-the-loop quality checks to deliver reliable, usable data at scale. Contact ScrapeHero to get started.

Table of contents

Scrape any website, any format, no sweat.

ScrapeHero is the real deal for enterprise-grade scraping.

Clients love ScrapeHero on G2

Ready to turn the internet into meaningful and usable data?

Contact us to schedule a brief, introductory call with our experts and learn how we can assist your needs.

Continue Reading

How to Automate Amazon Product Scraping With n8n and ScrapeHero

How to Automate Amazon Product Scraping With n8n and ScrapeHero

Automate Amazon price tracking with n8n
ScrapeHero now connects to n8n

ScrapeHero Cloud Now Connects to n8n

Product update: ScrapeHero Cloud connects to n8n with a native node.
ScrapeHero Cloud Scraper vs API

ScrapeHero Cloud Scraper vs API: 10 Things to Know Before Making a Decision

The difference between ScrapeHero Cloud's scrapers and an APIs.
ScrapeHero Logo

Can we help you get some data?