Automating Lead Generation: Google Maps Scraping with N8N
The internet has fundamentally changed how businesses operate, and at the heart of this revolution are automation tools. N8N (Node-based workflow automation) has emerged as a key player, simplifying complex processes and freeing up valuable time for entrepreneurs and managers. If your business relies on active B2B or B2C customer prospecting, the task of finding qualified leads can be time-consuming and repetitive. Fortunately, there is a way to automate the search for new clients directly within Google Maps, transforming public data into concrete sales opportunities.
![]()
In this detailed technical guide, we will dive into creating an N8N workflow capable of scraping business information from Google Maps, using specific ZIP codes and business categories. You will learn how to configure Google API credentials, integrate N8N with Google Sheets for data management, and finally, execute the automation that will bring valuable lists of potential clients—including emails, phones, and websites—directly to your spreadsheet. Prepare to elevate your prospecting strategy to a new level of efficiency.
N8N as a Strategic Tool for Lead Generation
N8N is not just a task orchestrator; it is an integration platform that allows connecting hundreds of services (APIs) without the need for complex coding. In the context of lead generation, N8N’s ability to interact with geospatial data APIs, such as Google Maps (via the Places API), represents a significant competitive advantage. While manual prospecting requires hours of searching, click by click, automation gets the job done in minutes, scalably and precisely.
Advantages of Automated Scraping
- Scalability: Search thousands of leads across different regions simultaneously.
- Geographic Focus: Target searches to busy avenues, commercial districts, or specific shopping centers, ensuring leads are relevant to your operational area.
- Data Richness: Obtain standardized and structured information, such as address, phone, website, review rating, and, crucially, contact emails, when available.
- Efficiency: Eliminate repetitive work, allowing your sales team to focus on what truly matters: closing deals.
Initial Configuration: Preparing the Groundwork
For the automation to work, we need two essential provided components: the N8N workflow JSON file and a Google Sheets template (XLSX) that will serve as the database and control center.
Importing the Workflow (JSON)
Assuming you already have N8N installed and running (either locally or on a server), the first step is to import the pre-configured workflow. This JSON file contains all the automation logic but will need to be connected to your credentials and your spreadsheet.
- Access your N8N interface.
- Click on
Create Workflow. - Upload the
Google Maps Scraping Jasonfile. - The complete workflow will appear on your screen, ready to be configured.
Preparing the Google Sheets Template
Google Sheets will act as the entry point for the search (where you input ZIP codes and categories) and the exit point (where the results will be written). It is vital not to alter the structure of the tabs to avoid breaking the N8N flow.
- Create a dedicated folder in your Google Drive (e.g., ‘Leads N8N’).
- Upload the
Scrap Google Maps XLSXfile to this folder. This action converts the XLSX file into a Google Sheet. - Open the newly created Google Sheet. Note the two essential tabs:
resultsandchecklist. Do not rename these tabs.
Understanding the Workflow Logic and Normalization
The imported N8N workflow comprises several interconnected nodes. The initial step is ensuring the workflow knows where to find your input data. This is achieved through the Normaliza node, typically a Set node, which holds key variables.
Configuring the Normalization Node
Double-click the Normaliza node. You need to configure three crucial fields:
- URL da planilha (Spreadsheet URL): Copy the entire URL from the browser address bar when viewing your Google Sheet (the one you uploaded). Paste it into this field.
- Página Categorias (Category Page): This should reference the tab name containing the search categories (e.g.,
checklist). - Page: This should reference the tab name where the search parameters (ZIP Codes/CEPs) are defined.
By configuring the Normaliza node, the subsequent Google Sheets node can dynamically retrieve the necessary information (ZIP codes and target categories) without hardcoding values.
Defining Targets: ZIP Codes and Categories
The true power of this automation lies in the input data you provide in the checklist tab of your Google Sheet. This is where you define the scope of your search.
- In the
checklisttab, list the ZIP codes (CEPs) for the areas you want to prospect. Focus on high-traffic commercial zones, main avenues, or business clusters. - List the business categories you are targeting (e.g., ‘Dentist’, ‘Restaurant’, ‘Law Firm’).
- Advanced Tip: Category Expansion: To maximize results, use synonyms or related terms. Instead of just ‘Dentist’, also include ‘Odontology’, ‘Dental Implant Clinic’, or ‘Orthodontics’. This ensures the Places API captures a wider range of relevant businesses.
Essential Google API Credentials Configuration
The most critical and complex step is setting up the Google APIs and creating the necessary credentials for N8N. This process requires activating specific services within the Google Cloud Console and generating OAuth 2.0 credentials.
Step 1: Activating Necessary APIs
You must enable four specific APIs within your Google Cloud Project. If you don’t have a project, you will need to create one in the Google API Console.
- Search for Google Sheets API and click ‘Enable’ (or ‘Manage’ if already enabled). This allows N8N to read and write data to your spreadsheet.
- Search for Google Drive API and click ‘Enable’. This ensures N8N can access the file stored in your Drive.
- Search for Places API and click ‘Enable’.
- Search for Places API New and click ‘Enable’. This is often the primary API used for detailed business data scraping.
Note on Places API New: Activating this API requires linking a billing account. While Google offers a free tier (typically up to 1,000 requests per month, which is enough for extensive lead generation), you must provide billing information (credit card) to activate the service. Always monitor your usage to stay within the free limits if necessary. The cost per search beyond the free tier is usually negligible (e.g., a few dollars per 10,000 searches).
Step 2: Creating OAuth 2.0 Credentials
N8N uses OAuth 2.0 to securely connect to your Google services without needing your permanent password. You will create a Client ID and a Client Secret.
- In the Google API Console, navigate to APIs & Services > Credentials.
- Click Create Credentials > OAuth client ID.
- Select Web application as the Application type. Give it a descriptive name (e.g., ‘N8N Leads Test’).
- Crucial Step: Redirect URIs. N8N provides a specific redirect URL when you attempt to create a new Google credential within its interface. Copy this URL from N8N (it usually looks like
https://your-n8n-url/rest/oauth2-credential/callback). - Paste the copied N8N URL into the Authorized redirect URIs field in the Google Console.
- Click ‘Create’. Google will provide you with the Client ID and the Client Secret. Copy both immediately.
Integrating Credentials in N8N
Now that you have the Client ID and Secret, you must input them into the respective N8N nodes.
1. Google Sheets Node Connection
The first Google Sheets node in the workflow handles reading the input data (ZIP codes and categories).
- Open the Google Sheets node and click to create a new credential.
- Paste the Client ID and Client Secret you obtained in the previous step.
- Click the ‘Connect with Google’ button at the bottom. This will open a separate browser window.
- Account Consistency: Ensure you log in with the exact same Google account used to create the API project and the one hosting the Google Sheet file.
- Once connected, the credential status in N8N will turn green, indicating success.
2. Google Places/Scraping Node Connection
The node responsible for scraping (likely a Google Auth 2 API node configured for Places) also requires credentials, but with an added requirement: Scope.
- Open the scraping node and initiate the creation of a new credential.
- Paste the same Client ID and Client Secret.
- Defining Scope: The scope dictates exactly which permissions N8N is requesting from Google. For Places API scraping, you need a specific scope URL.
- Input the following scope URL into the designated field:
https://www.googleapis.com/auth/cloud-platform(or similar scope related to Google Cloud Platform access). This scope grants the necessary permissions for the Places API calls. - Click ‘Connect with Google’ and log in using the mandatory matching Google account.
Scope Explanation: Scopes are security tokens. While the Google Sheets node needed permission only for Sheets and Drive access, the scraping node requires broader access to Google Cloud services (where Places API resides). Using the correct scope is essential for authorization.
Running the Automation and Extracting Data
With the workflow configured and all credentials verified, the system is ready to run. Before executing, ensure that in your Google Sheet checklist tab, the ‘scraped’ column is empty or removed for the lines you wish to process.
Execution and Monitoring
- Click the ‘Execute Workflow’ button (or ‘Play’ button) in N8N.
- The workflow will begin its loop: reading the first ZIP code and category, calling the Places API, and then writing the results to the
resultstab. - Monitor the execution flow in N8N. You will see data passing through the nodes, confirming that the Google Sheets read is working and the Places API calls are being made successfully.
- Check your Google Sheet
resultstab. Data should start populating automatically, often including:
- Business Name
- Address
- Phone Number
- Website URL
- Email (if publicly available via the API)
- Google Rating and Review Count
As the automation processes each ZIP code/category combination, the workflow marks the corresponding row in the checklist tab as ‘scraped’. This prevents duplicate processing in future runs.
Strategy: Maximizing Lead Quality and Volume
The output of this automation is only as good as the input strategy. Effective lead generation requires careful planning regarding target areas and search terms.
Selecting High-Value Geographic Areas
Focus your ZIP code searches on areas known for commercial activity relevant to your service. For example, if you sell digital marketing services to small businesses, target:
- Major commercial avenues in capital cities.
- Industrial parks or business centers.
- High-density retail areas (malls, downtown districts).
This targeted approach ensures your scraped leads are geographically and contextually relevant, increasing conversion probability.
Filtering and Data Enrichment
While the N8N workflow provides rich data, not every lead will be perfect. Implement a post-scraping strategy:
- Filter by Completeness: Prioritize leads that include a website and/or email address. These businesses are usually more digitally mature and responsive.
- Filter by Rating: Depending on your service, you might target businesses with high ratings (established, successful clients) or low ratings (clients needing immediate help with reputation management).
- Manual Verification: Use the scraped data to quickly verify the business type and size before initiating contact.
The scraped list is the foundation; successful sales depend on how effectively you transform this raw data into personalized outreach.
Conclusion: Transforming Data into Revenue
The integration of N8N with Google APIs fundamentally shifts the paradigm of lead generation. What was once a tedious, manual chore is now a robust, automated pipeline delivering qualified contacts directly to your sales team. By mastering this workflow, you gain the ability to precisely target your market, scale your prospecting efforts, and maintain a constantly refreshed database of potential clients.
This technical exercise in setting up the Google API credentials, understanding OAuth 2.0 scopes, and configuring the N8N nodes is your first step into advanced business automation. Utilize this powerful tool to find your next thousand clients and redefine your business growth trajectory.
