See llms.txt for all machine-readable content.

Back to Templates

Extract marketing agency emails from Google Maps with GPT-4o-mini and Google Sheets

Quick overview

This workflow programmatically generates exhaustive Google Maps search queries for a business type and city using OpenAI, scrapes Google Maps search results to collect business websites, visits each site, extracts unique emails, and appends results to Google Sheets—all without a Google Maps API key.

How it works

  1. Initiates manually when the workflow is tested.
  2. Uses OpenAI to create a list of Google Maps search queries targeting all neighborhoods for a specified business type and city.
  3. Iterates over these queries, constructs Google Maps URLs, and scrapes Google Maps web results for each search.
  4. Extracts outbound URLs from the scraped Google Maps HTML and filters out irrelevant (Google-owned) domains.
  5. Removes duplicate and limits the number of websites per batch for subsequent processing.
  6. Visits each unique business website URL, fetches the page, and uses custom JavaScript to extract all email addresses, filtering out common spam traps and obvious blacklisted domains.
  7. Collects and deduplicates valid emails, then appends them to a connected Google Sheet for later use.

Setup

  1. Add your OpenAI API key to enable business-location query generation via the 'OpenAI Chat Model' node.
  2. Connect your Google Sheets account and set the target spreadsheet and sheet name in the "Add to Sheet" node.
  3. Adjust the "City" and "Business" values in the "Edit Fields1" node to the region and business type you want to target.
  4. Optionally, refine filtering logic for emails or websites in the relevant code nodes if you have specific blacklist requirements.
  5. Run the workflow manually in n8n, as this template is triggered by the "Test workflow" button.

Additional info

Built by Shahrukh Majeed, n8n Verified Creator. Case studies and a free workflow diagnostic: https://www.shahrukhmajeed.com