Google Maps Lead Extraction and Email Scraper - n8n Workflow

Use this powerful n8n workflow to scrape business leads from Google Maps, extract website URLs, find associated email addresses using custom JavaScript code, and export the results directly to Google Sheets for outreach.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Sales & Marketing Teams: Seeking automated, localized lead lists without reliance on expensive third-party APIs.

  • n8n Automation Specialists: Users looking for advanced examples of combining HTTP requests, custom JavaScript, and looping logic within an n8n workflow.

  • Data Analysts: Individuals needing clean, deduplicated business contact information sourced directly from the web.

  • Agencies: Professionals who manage local SEO or outreach campaigns for clients.

Overview

Generating localized business leads often involves manual research or costly paid services. This advanced n8n workflow solves this problem by providing a robust, self-hosted system for targeted scraping.

This n8n template bypasses common API limitations by directly scraping Google Maps HTML for business listings. It then intelligently visits each extracted website and uses regex (via the Code n8n node) to efficiently locate and extract email addresses. Crucially, the workflow incorporates built-in delays and error handling to maximize success rates and prevent rate limiting.

The final output is a clean, deduplicated list of emails automatically added to a Google Sheets spreadsheet, ready for immediate use in outreach campaigns. This demonstrates a highly effective, cost-efficient approach achievable entirely within n8n.

How it Works

This comprehensive n8n workflow executes a four-phase data pipeline:


  1. Initiation and Maps Scraping: The n8n trigger is manual ('When clicking Test workflow'). It immediately activates the 'Scrape Google Maps' n8n node, which sends an HTTP request to a Google Maps search URL (e.g., 'calgary dentists') to pull the raw HTML data.

  2. URL Cleaning and Preparation (Step 2): A custom JavaScript n8n node ('Extract URLs') uses regex to identify all potential URLs within the scraped data. The subsequent 'Filter Google URLs' n8n node removes irrelevant domains (like Google's own internal links and gstatic files). The data is then deduplicated and limited for efficient batch processing.

  3. Smart Website Crawling (Step 3): The 'Loop Over Items' n8n node processes each unique business website URL sequentially. To ensure operational reliability and prevent rate limiting, 'Wait' n8n node instances are placed before and after the 'Scrape Site' HTTP request, creating necessary delays. The 'Scrape Site' n8n node fetches the content of the target business website. Error handling is configured to continue the process even if individual sites fail to load.

  4. Email Extraction and Export (Step 4): A second custom JavaScript n8n node ('Extract Emails') analyzes the scraped website content using advanced regex to find email addresses, while filtering out potential false positives (like image file extensions). The results are filtered ('Filter Out Empties'), split into individual items ('Split Out'), and finally run through a 'Remove Duplicates' n8n node for a final quality check. The finalized, clean email list is appended directly to Google Sheets using the relevant n8n node.

Installation Guide

To deploy this powerful lead generation n8n workflow, follow these steps:


  1. Import the n8n template: Copy the provided JSON data and paste it into your n8n instance via the 'Import from JSON' option.

  2. Configure Credentials:

* Google Sheets: You will need to set up a Google Sheets credential for the 'Add to Sheet' n8n node. Click on the credential field, select 'Create New,' and authorize n8n to access your Google account.

  1. Customize the Search Query: Locate the 'Scrape Google Maps' n8n node. Change the URL parameter https://www.google.com/maps/search/calgary+dentists to reflect your desired location and business type (e.g., 'london architects').

  2. Adjust Limits and Delays: For production use, remove or significantly increase the limit in the 'Limit' n8n node. Adjust the wait times in the 'Wait' n8n node instances if you encounter frequent rate-limiting errors.

  3. Test the n8n workflow: Click 'Test workflow' on the manual n8n trigger to ensure data flows correctly and credentials are valid before activating the workflow.

Node Details

When clicking ‘Test workflow’ (Manual Trigger n8n trigger):
Function: Starts the n8n workflow immediately upon command. Essential for developing and testing this specialized n8n template.
Scrape Google Maps (HTTP Request n8n node):
Function: Initiates the web scraping process by downloading the raw HTML from the target Google Maps search results.
Key Configuration: URL is set to the specific search query (e.g., Calgary dentists).
Extract URLs (Code n8n node):
Function: Uses custom JavaScript and a robust regex pattern to parse the raw Google Maps HTML and extract potential business website URLs.
Key Configuration: JavaScript code defines a regex to capture http(s):// links.
Loop Over Items (Split In Batches n8n node):
Function: Controls the flow by ensuring each unique website URL is processed sequentially, which is vital for preventing simultaneous heavy traffic and ensuring reliability of the n8n workflow.
Scrape Site (HTTP Request n8n node):
Function: Visits and downloads the HTML content of each individual business website.
Key Configuration: Dynamic URL reference ={{ $json.website }}. Set to 'Continue Regular Output' on error, allowing the n8n workflow to skip sites that time out.
Extract Emails (Code n8n node):
Function: Executes specialized JavaScript regex on the scraped website HTML to identify and list email addresses, specifically excluding image extensions.
Split Out (n8n node):
Function: Flattens the data structure, taking the array of emails found on one website and converting each email into a separate item for easier deduplication and export.
Remove Duplicates (n8n node):
Function: Used twice—once to clean URLs and finally to ensure the list of extracted emails is completely unique before export.
Add to Sheet (Google Sheets n8n node):
* Function: Appends the finalized, clean list of email addresses to a specific Google Sheet document, completing the data export phase of the n8n workflow.

Related n8n Workflows

Free

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

Hi 👋 I'm Nick. I make money with automation & teach others how they can too. If you have any questions about my templates or about my n8n builds, feel free to ask and I'll happily respond in the comments. Thanks for reading!

Featured*