Back to Templates

Extract Local Business Contacts with Google Sheets, SerpAPI, Apify & GPT-4o

Created by

Created by: Robert Breen || rbreen

Robert Breen

Last update

Last update 2 days ago

Share


Extract Local Business Contacts with Google Sheets, SerpAPI & GPT‑4o

Status: Ready for Use ✅
Disclaimer: This workflow relies on community nodes that are not part of n8n’s core package.
Install the following from n8n → Community Nodes before running:

  • n8n-nodes-langchain
  • n8n-nodes-openai (Structured Output Parser)
  • n8n-nodes-apify

📝 Description

This n8n workflow automates discovery of local‑business contact details by search term and location, then enriches the results with publicly listed email addresses using GPT‑4o AI.


🔑 Key Features

🔗 Google Sheets Integration

  • Reads search terms and locations from a Google Sheet.
  • Processes only rows that are not marked Complete, preventing duplicates.

🗺️ Google Maps Search via SerpAPI

  • Queries Google Maps through SerpAPI for every search‑term‑and‑location pair.
  • Retrieves the following fields: business name, website, street address, and phone number.

🧠 Website Scraping & Email Extraction

  1. Scrapes the business homepage content with Apify’s Fast Website Content Crawler.
  2. Sends the scraped HTML to a GPT‑4o AI Agent.
  3. Extracts any publicly listed email address.
  4. Returns a clean, structured JSON object for downstream use.

💾 Data Storage & Tracking

  • Writes every result to a Results tab in the same Google Sheet.
  • Marks the corresponding row in the Searches tab as Complete once finished.

🧱 Extensible Design

The workflow uses modular sub‑workflows and AI agents.
You can easily extend it to add:

  • Phone‑number verification with Twilio
  • Social‑media enrichment with Clearbit
  • Exports to HubSpot, Salesforce, Airtable, PostgreSQL, or CSV files

📄 Google Sheet Setup

Create a Searches tab with these exact columns (one header row):

Search | Area | Area Name | Complete

Create a results tab with these columns

title | website | address | phone | Search | Search Name | Area | email (Manual Entry)


⚙️ Prerequisites

  1. Google Cloud Project with Google Sheets API and Google Drive API enabled
  2. SerpAPI account (free trial or paid) – obtain an API key
  3. Apify account (free trial or paid) with the Fast Website Content Crawler actor installed
  4. OpenAI account with an API key that can access GPT‑4o models

🚀 Setup Instructions

  1. Copy the Google Sheet

  2. Configure Google Sheets nodes in n8n

    • Open the workflow.
    • Update the nodes Extract Search Terms and Save Emails to Sheet to point at your copied sheet.
    • Authenticate using Google OAuth2 credentials that have access to the sheet.
  3. Add SerpAPI credentials

    • Sign in at <https://serpapi.com>.
    • Copy your API key.
    • In the Search Google Maps node, create a new credential and paste the key.
  4. Set up Apify

    • Sign up at <https://apify.com>.
    • Add the Fast Website Content Crawler actor to your account.
    • In the Scrape Web Page HTTP node, append ?token=YOUR_API_KEY to the actor URL.
  5. Add your OpenAI API key


✅ Running the Workflow

  1. Click Execute Workflow in n8n.
  2. For each unprocessed row in the Searches tab, the automation will:
    1. Retrieve business information from Google Maps via SerpAPI.
    2. Scrape the business website using Apify.
    3. Use GPT‑4o to extract a public email address.
    4. Write all collected data to the Results tab.
    5. Mark the original row as Complete.

🧩 Example Use Cases

  • Build highly targeted lead lists for sales and marketing outreach.
  • Compile local business directories for regional websites or apps.
  • Automate contact‑information collection for lead‑generation campaigns and reduce manual data entry.