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
- Initiates manually when the workflow is tested.
- Uses OpenAI to create a list of Google Maps search queries targeting all neighborhoods for a specified business type and city.
- Iterates over these queries, constructs Google Maps URLs, and scrapes Google Maps web results for each search.
- Extracts outbound URLs from the scraped Google Maps HTML and filters out irrelevant (Google-owned) domains.
- Removes duplicate and limits the number of websites per batch for subsequent processing.
- 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.
- Collects and deduplicates valid emails, then appends them to a connected Google Sheet for later use.
Setup
- Add your OpenAI API key to enable business-location query generation via the 'OpenAI Chat Model' node.
- Connect your Google Sheets account and set the target spreadsheet and sheet name in the "Add to Sheet" node.
- Adjust the "City" and "Business" values in the "Edit Fields1" node to the region and business type you want to target.
- Optionally, refine filtering logic for emails or websites in the relevant code nodes if you have specific blacklist requirements.
- 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