Back to blog
Guides & How-tos2025-08-30·9 min read

Extract Google Maps Data with JavaScript: Complete Technical Guide

By Ibrahim DemolCEO IBLeadUpdated March 26, 2026

Google Maps holds 200+ million business listings. Every entry contains phone numbers, websites, hours, reviews, addresses, and customer feedback. That data has value — for lead generation, market research, competitive analysis, or reputation monitoring.

You can access it three ways: the official Google Maps API (complex, costly), browser automation (technical, time-consuming), or specialized tools (simple, fast). This guide covers all three, with working code examples and honest trade-offs.

By the end, you'll understand which approach fits your use case.


Why Extract Google Maps Data?

Before diving into code, understand the business case.

Lead generation: Find 500 plumbers in Chicago with phone numbers and websites in 10 minutes instead of 2 hours of manual research.

Market research: Analyze competitor locations, pricing (from website scrapes), review sentiment, and service gaps across a region.

Reputation monitoring: Track which businesses have dropped below 3-star ratings, identify review trends, spot fake reviews.

Sales intelligence: Build targeted lists for ABM campaigns — find all companies using specific tools (WordPress, HubSpot, Shopify) in your target market.

Expansion planning: Identify underserved areas by mapping competitor density, customer reviews, and service gaps.

Real example: A home services franchise wanted to expand into 5 new cities. Instead of hiring scouts, they extracted 2,000+ competitor listings per city (location, reviews, hours, website), identified patterns in high-review businesses, and opened in neighborhoods with the least competition. Time: 3 hours. Cost: $0 (using free tools).


How Google Maps Data Works

Google Maps operates as a public database. When you search "plumbers near me," Google queries its index and returns results with:

  • Business name, address, phone
  • Website URL
  • Opening hours
  • Customer reviews (text, rating, date, author)
  • Photos (count, thumbnails)
  • Service areas
  • Verification status
  • Google Place ID (unique identifier)

This data is publicly visible — anyone can access it through the Google Maps interface. The question isn't whether the data exists; it's how you retrieve it at scale.

Three methods exist:

  1. Official Google Maps API — Authorized, documented, rate-limited
  2. Browser automation — Mimics user behavior, works around rate limits, technically complex
  3. Pre-indexed databases — Data already extracted and organized, fastest approach

Method 1: Google Maps API with JavaScript

The official approach. Google provides several APIs for different use cases.

Which APIs Extract Business Data?

Places API — Returns business listings, reviews, photos, opening hours, contact info. Most commonly used.

Geocoding API — Converts addresses to coordinates and vice versa.

Directions API — Calculates routes, travel time, distance.

Maps JavaScript API — Displays maps and business markers on web pages.

For extracting business data, you need the Places API (specifically the "Nearby Search" and "Text Search" endpoints).

Step 1: Set Up Your Google Cloud Project

  1. Go to console.cloud.google.com
  2. Create a new project (top-left dropdown → "New Project")
  3. Name it (e.g., "Maps Data Extraction")
  4. Wait 30 seconds for creation
  5. Select the project
  6. Go to APIs & ServicesLibrary
  7. Search for "Places API" → Click it → Enable
  8. Go to APIs & ServicesCredentials
  9. Click Create CredentialsAPI Key
  10. Copy your API key (you'll need this for every request)

Cost: Google gives €200/month free credits. Most small-scale extractions fit within this.

Step 2: Understand API Pricing

You pay per request, not per result.

API Cost per 1,000 requests Notes
Places API (Basic) $32 Name, address, phone, website, opening hours
Places API (Contact) $17 Same + email, phone
Places API (Atmosphere) $17 Same + reviews, ratings, photos
Geocoding API $5 Address ↔ Coordinates
Directions API $5 Route, travel time, distance

Example cost: Extracting 10,000 businesses with basic info = 10,000 requests = $320. With $200 free credits, you pay $120 out of pocket.

If you need 100,000 businesses, that's $3,200 — expensive for large-scale projects.

Step 3: Geocoding Example (Convert Address to Coordinates)

Use case: You have a list of addresses and need latitude/longitude for mapping.

Code:

const https = require('https');

const address = "1600 Pennsylvania Avenue NW, Washington, DC";
const apiKey = "YOUR_API_KEY_HERE";

// Encode the address for URL (spaces → %20, commas → %2C)
const encodedAddress = encodeURIComponent(address);

const url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodedAddress}&key=${apiKey}`;

https.get(url, (response) => {
  let data = '';

  response.on('data', (chunk) => {
    data += chunk;
  });

  response.on('end', () => {
    const result = JSON.parse(data);

    if (result.results.length > 0) {
      const location = result.results[0].geometry.location;
      console.log(`Latitude: ${location.lat}`);
      console.log(`Longitude: ${location.lng}`);
      console.log(`Formatted Address: ${result.results[0].formatted_address}`);
    }
  });
}).on('error', (err) => {
  console.error('Error:', err);
});

Output:

Latitude: 38.8951
Longitude: -77.0369
Formatted Address: 1600 Pennsylvania Avenue NW, Washington, DC 20500, USA

What's happening: You send the address to Google's servers. They match it against their database, return the closest coordinates, and the formatted version. Simple one-to-one lookup.

Step 4: Nearby Search Example (Find Businesses by Category + Location)

Use case: Find all restaurants within 1 km of a specific point.

Code:

const https = require('https');

const apiKey = "YOUR_API_KEY_HERE";
const latitude = 40.7128;  // New York
const longitude = -74.0060;
const radius = 1000;  // 1 km
const keyword = "restaurant";

const url = `https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=${latitude},${longitude}&radius=${radius}&keyword=${keyword}&key=${apiKey}`;

https.get(url, (response) => {
  let data = '';

  response.on('data', (chunk) => {
    data += chunk;
  });

  response.on('end', () => {
    const result = JSON.parse(data);

    console.log(`Found ${result.results.length} restaurants:`);

    result.results.forEach((place) => {
      console.log(`\nName: ${place.name}`);
      console.log(`Address: ${place.vicinity}`);
      console.log(`Rating: ${place.rating} (${place.user_ratings_total} reviews)`);
      console.log(`Place ID: ${place.place_id}`);
    });

    // Check if there are more results
    if (result.next_page_token) {
      console.log(`\nMore results available. Use next_page_token: ${result.next_page_token}`);
    }
  });
}).on('error', (err) => {
  console.error('Error:', err);
});

Output:

Found 20 restaurants:

Name: Balthazar
Address: 80 Spring Street, New York
Rating: 4.5 (1,203 reviews)
Place ID: ChIJIQBpAG2fwoAR_L12E10P3MQ

Name: Eleven Madison Park
Address: 11 Madison Avenue, New York
Rating: 4.7 (892 reviews)
Place ID: ChIJ0ZHZd6eewokRkurJVcf33V4

...

Limitations of this approach:

  • Returns max 20 results per request
  • To get all results, use next_page_token (requires multiple API calls = higher cost)
  • No email extraction (need to visit website separately)
  • No review text (only rating count)
  • Rate limits: 50 requests/second max
  • No filtering by review score, verification status, or number of photos

Method 2: Browser Automation (Selenium, Puppeteer)

If the Google API is too expensive or limited, you can automate a browser to mimic user behavior.

How it works: A script opens Chrome/Firefox, searches Google Maps for "plumbers in Chicago," clicks through results, extracts data from the DOM (page HTML), and saves it.

Why Use Browser Automation?

✅ No API costs (only your server costs) ✅ Access all visible data (reviews, photos, website content) ✅ No rate limits (technically — but Google can detect and block) ❌ Slower (takes 5-10 seconds per business vs. 0.1 seconds via API) ❌ Complex setup (requires Chrome/Firefox installation) ❌ Fragile (Google changes page layout → script breaks) ❌ Risky (Google actively blocks scrapers)

Basic Puppeteer Example

Setup:

npm install puppeteer

Code:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();

  // Navigate to Google Maps search
  await page.goto('https://www.google.com/maps/search/plumbers+in+chicago');

  // Wait for results to load
  await page.waitForSelector('[data-item-id]');

  // Extract business listings
  const businesses = await page.evaluate(() => {
    const items = [];
    document.querySelectorAll('[data-item-id]').forEach((element) => {
      items.push({
        name: element.querySelector('[data-item-id] .fontHeadlineSmall')?.textContent || 'N/A',
        rating: element.querySelector('.icon-star-fill')?.textContent || 'N/A',
        address: element.querySelector('[data-item-id] .fontBodySmall')?.textContent || 'N/A',
      });
    });
    return items;
  });

  console.log(businesses);

  await browser.close();
})();

Why this is risky: Google detects browser automation patterns (fast clicks, no mouse movements, missing headers). They block the IP or show CAPTCHAs. You'd need proxies, delays, and header spoofing — complex and unreliable.

Verdict: Browser automation works for small-scale extraction (< 100 businesses) but fails at scale.


Method 3: Pre-Indexed Business Databases

The fastest approach: someone else already extracted and organized the data.

How it works: A company (like IBLead) runs scrapers 24/7, extracts Google Maps listings monthly, cleans the data, and sells access via an API or web interface.

Advantages:

  • No coding required
  • Instant results (data already extracted)
  • Lower cost than Google API (bulk pricing)
  • Includes enriched data (emails, technologies detected, review text)
  • Supports complex filters (rating, review count, verification status, etc.)

Trade-offs:

  • Data is 1-30 days old (not real-time)
  • You depend on the provider's accuracy
  • Subscription model (not pay-per-use)

Example: IBLead extracts 50M+ Google Maps listings across 37 countries, updated monthly. You search by city/category/filters and export to CSV in 2 clicks.


Short answer: It depends on how you do it.

Using the Official Google Maps API

Legal — You're using Google's authorized service, following their terms of service. You pay for usage. No issues.

Browser Automation / Direct Scraping

⚠️ Gray area — Technically possible, but:

  1. Violates Google's Terms of Service — Section 10.3: "You will not... attempt to access or search Google Maps by any means other than Google's publicly supported interfaces."

  2. Violates the Computer Fraud and Abuse Act (CFAA) in the US — Unauthorized access to computer systems. Courts have ruled scraping can violate this.

  3. Copyright concerns — Business names, addresses, and reviews are copyrighted. Reproducing them without permission is copyright infringement.

  4. Practical enforcement — Google actively blocks scrapers. Your IP gets banned. You'd need proxies (adds complexity and cost).

Real case: In 2020, a company was sued for scraping LinkedIn profiles. The court ruled that even publicly visible data is protected if you violate terms of service to access it.

Best Practice

Use the official Google Maps API or a licensed data provider (IBLead, IBLead, etc.). You stay legal, avoid IP bans, and get reliable data.

If cost is a concern, compare:

  • Google API: $320 for 10,000 businesses
  • IBLead: €44/month for 10,000 credits (1 business = 1 credit) = €44 for 10,000 businesses
  • DIY Browser Automation: $0 upfront, but $500+ in proxies/infrastructure, plus risk of legal action

The licensed approach is cheaper and safer.


Practical Workflow: From Search to CSV Export

Let's walk through a real scenario: You need to find 500 electricians in Los Angeles with phone numbers and websites.

Option A: Google Maps API

Step 1: Geocode "Los Angeles" to get coordinates.

// Get LA coordinates: 34.0522, -118.2437

Step 2: Make nearby search requests for "electrician" within 15 km radius.

// First request: returns 20 results + next_page_token
// Second request: use next_page_token to get next 20
// ... repeat 25 times to get 500 results

Step 3: For each business, make a separate "Place Details" request to get phone number and website.

// Each business needs a separate API call
// 500 businesses = 500 additional requests

Total requests: 25 (nearby search) + 500 (place details) = 525 requests Total cost: (525 / 1,000) × $32 = $16.80 Time to code: 4-6 hours (if you know JavaScript) Time to execute: 10-15 minutes

Option B: IBLead

Step 1: Go to app.iblead.com Step 2: Search "electricians" in "Los Angeles" Step 3: Apply filters (rating > 4, verified businesses, etc.) Step 4: Export to CSV Step 5: Import into CRM

Total cost: €44/month (covers 10,000 credits; you use 500) Time to code: 0 (no coding) Time to execute: 2 minutes

Bonus features in IBLead: - Email addresses (extracted from websites) - 160+ technology detections (WordPress, Shopify, HubSpot, etc.) - Google review text and sentiment - SIRET/SIREN data (France only) - Filtering by review score, review count, photos, verification status


Extracting Google Maps Reviews (Advanced Use Case)

Reviews are valuable for reputation monitoring, market research, and competitive analysis.

The Challenge

The Google Maps API does NOT return review text. You get the review count and average rating, but not individual reviews.

API response:

{
  "name": "Joe's Diner",
  "rating": 4.3,
  "user_ratings_total": 287
}

You don't get: - Individual review text - Reviewer name - Review date - Star rating per review

Browser Automation Approach

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();

  // Navigate to a business on Google Maps
  await page.goto('https://www.google.com/maps/place/Joes+Diner');

  // Scroll through reviews section
  const reviews = await page.evaluate(() => {
    const reviewList = [];
    document.querySelectorAll('[data-review-id]').forEach((review) => {
      reviewList.push({
        author: review.querySelector('.EWp0qd')?.textContent || 'Anonymous',
        rating: review.querySelector('[aria-label*="star"]')?.getAttribute('aria-label') || 'N/A',
        text: review.querySelector('.wiI7pd')?.textContent || '',
        date: review.querySelector('.rsqaWe')?.textContent || 'N/A',
      });
    });
    return reviewList;
  });

  console.log(reviews);
  await browser.close();
})();

Output:

[
  {
    "author": "Sarah M.",
    "rating": "5 stars",
    "text": "Best breakfast in town! Highly recommend the pancakes.",
    "date": "2 weeks ago"
  },
  {
    "author": "John D.",
    "rating": "3 stars",
    "text": "Good food but slow service.",
    "date": "1 month ago"
  }
]

Why this matters:

  • Reputation monitoring: Automatically flag businesses with new 1-2 star reviews
  • Competitive analysis: Extract competitor reviews to understand what customers value
  • Sentiment analysis: Use NLP to categorize reviews by topic (food, service, price, etc.)

The catch: Google blocks this at scale. After 50-100 reviews, you hit CAPTCHAs or IP bans.

IBLead's Approach (Exclusive Feature)

IBLead scrapes review text, author, rating, and date for every business. You can filter by: - Minimum/maximum rating - Date range (last 30 days, last year, etc.) - Keyword in review text

Use case: Find all businesses with < 3 average rating in your market → personalize outreach to mention their low reviews → offer reputation repair services.


Common Challenges and Solutions

Challenge 1: Rate Limiting

Problem: Google Maps API limits you to 50 requests/second. If you make more, requests fail.

Solution: Add delays between requests.

function delay(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

for (let i = 0; i < 100; i++) {
  // Make API request
  await makeRequest();

  // Wait 200ms before next request
  await delay(200);
}

Challenge 2: Missing Data

Problem: Some businesses don't have phone numbers or websites listed on Google Maps

Ready to get started?

Access every Google Maps business, enriched with emails and legal data.

Try IBLead free