Scrape B2B leads from Google Maps to Google Sheets with HasData
This n8n template shows how to build a complete B2B lead generation pipeline that scrapes Google Maps for businesses and enriches them with emails from their websites or Google search. Use cases: Find local businesses...
Template notes
This n8n template shows how to build a complete B2B lead generation pipeline that scrapes Google Maps for businesses and enriches them with emails from their websites or Google search.
Use cases: Find local businesses with contact info for cold email campaigns, B2B prospecting, market research, or building CRM databases.
How it works
1. You define search queries, locations, and page counts in a config sheet inside a Google Spreadsheet called "Leads". 2. On each run, the workflow creates a new timestamped results sheet so previous runs don't get overwritten. 3. It reads every row from config, generates paginated search tasks (20 results per page), and fires them at the HasData Google Maps API. 4. Results get split into individual businesses. Duplicates are removed by name and place ID. 5. For each business with a website, the HasData web scraper hits the URL directly and pulls any emails it finds. 6. If no emails turn up on the website, or there's no website at all, the workflow runs a targeted Google search: "business name, city" email "@" and parses the organic results with a regex. 7. All leads (whether emails came from the site or from Google) merge into one stream and get written to the results sheet: name, phone, address, website, emails, rating, reviews, type.
How to set up
1. Install the [HasData n8n node](https://www.npmjs.com/package/@hasdata/n8n-nodes-hasdata) on your self-hosted instance. 2. Connect your HasData API credentials and your Google Sheets OAuth2 credentials inside the workflow. 3. In your Google Spreadsheet named Leads, add a sheet called config with these columns: - leadsquery for the search term (e.g. coffee shops) - location for city, state, zip code, or a specific address - pagecount for number of pages to fetch (20 results per page) - offset for starting page number (use 1 to start from the beginning) 4. Click Manual Trigger to run.
Requirements
- Self-hosted n8n (community node required) - [HasData](https://hasdata.com/) account with API key - Google account with Sheets API access (OAuth2) - Google Spreadsheet named Leads with a config sheet