B2B Lead Generation using Google Places API and Google Sheets - n8n Workflow

Use this efficient n8n workflow to generate targeted B2B leads by querying the Google Places API for specific industries and locations, automatically saving rich contact details to a Google Sheet.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Sales development representatives (SDRs) needing targeted industry lists.
Marketing agencies building outreach campaigns based on geography.
Data analysts looking to map local markets or competition.
Users seeking advanced examples of API handling and pagination within an n8n workflow.

Overview

Manually compiling targeted lead lists based on industry and location is time-consuming and often yields inconsistent data. This specialized n8n workflow solves this by utilizing the Google Places API's Text Search feature to rapidly identify relevant businesses and the Place Details API to enrich the results with crucial contact information like phone numbers, addresses, and websites.

Built on robust n8n templates, this automation is designed to handle API pagination limitations—fetching up to three pages of results—and incorporates necessary wait steps to adhere to Google Maps API constraints regarding nextpagetoken activation. The final output is automatically formatted and delivered directly into a structured Google Sheet, providing a clean, ready-to-use B2B lead list. Setting up this n8n workflow is a powerful step towards scalable data acquisition.

How it Works

The process begins with the Submit Search Query form n8n trigger, where the user inputs the desired industry and location (e.g., 'Plumbers New York').


  1. Initial Search (Page 1): The workflow executes the first Google Places Text Search API call using the user's input.

  2. Pagination Check: The results from Page 1 are immediately checked by the Has Next Page? (Page 2) n8n node for the existence of a nextpagetoken.

  3. Wait and Fetch (Page 2): If the token exists, the workflow enters a 5-second pause using an n8n node (Wait 5s (1)). This pause is crucial for allowing the Google Maps API token to activate. It then fetches Text Search Page 2.

  4. Pagination Check (Page 3): Results from Page 2 are checked by the Has Next Page? (Page 3) n8n node, and if a new token is found, the workflow repeats the wait step and fetches Text Search Page 3.

  5. Merge and Split: All retrieved pages (up to three) are combined by the Merge All Pages n8n node. The consolidated results are then broken down into individual business items using the Split out the Results n8n node.

  6. Data Enrichment: For each individual item, the workflow calls the Get Place Details n8n node via an HTTP Request, using the unique place_id to retrieve detailed information (website, phone number, formatted address).

  7. Format and Output: The Format the Output for Google Sheets code n8n node cleans and structures the extracted data, ensuring the fields match the target Google Sheet columns. Finally, the enriched leads are appended to the designated Google Sheet using the Google Sheets n8n node.

Installation Guide

To deploy this specialized n8n workflow, follow these steps:


  1. Import the Workflow: Copy the provided JSON and paste it directly into your n8n instance.

  2. Google Cloud Setup: Enable billing and the Google Places API (specifically Text Search and Place Details) in your Google Cloud Project.

  3. API Key Configuration: Obtain a Google Maps API Key. You must paste this key into the configuration of the four HTTP Request nodes: Text Search Page 1, Text Search Page 2, Text Search Page 3, and Get Place Details.

  4. Google Sheets Setup: Create a new Google Sheet with headers that correspond to the desired output (e.g., Company Name, Phone Number, Address, Website).

  5. Credential Setup: Create an OAuth credential for Google Sheets within n8n. Assign this credential to the Append rows in the Google Sheet n8n node.

  6. Sheet Configuration: Update the Google Sheets n8n node by selecting your document ID and the correct sheet name where the lead data should be written.

  7. Test: Activate the n8n trigger form and run a test query to verify data flows correctly.

Node Details

Submit Search Query (Form Trigger): The starting n8n trigger point. It accepts user input for Query (Industry + Location) to initiate the search.
Text Search Page 1/2/3 (HTTP Request): Sends queries to the Google Places Text Search API. These nodes use expressions to pass the user-defined query or the dynamic nextpagetoken for sequential page fetching.
Has Next Page? (If n8n node): Determines the control flow. It checks if the JSON response contains the nextpagetoken field. If true, the workflow proceeds to the waiting and subsequent HTTP Request n8n node.
Wait 5s (1/2) (Wait n8n node): A critical flow control n8n node designed to introduce a 5-second delay. This ensures the nextpagetoken generated by Google Maps API is active before the next API call is made, preventing errors.
Merge All Pages (Merge n8n node): Consolidates the results from the various Text Search pages into a single dataset before processing.
Get Place Details (HTTP Request): Uses the placeid from the search results to call the Place Details API, specifically requesting name, formattedphonenumber, website, and formattedaddress.
Format the Output for Google Sheets (Code n8n node): A JavaScript code n8n node that maps the sometimes nested and verbose API response data into a flat JSON structure suitable for Google Sheets, handling missing fields by assigning null.
Append rows in the Google Sheet (Google Sheets n8n node): The final action node. It authenticates using OAuth and appends the fully formatted B2B lead data as new rows in the specified spreadsheet.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

Founder - Runwise AI Agency

Featured*