Skip to content
 
 

Repository files navigation

Google Maps Zip Code Scraper

Scrape business listings from Google Maps across every zip code in the US. Comes with a bundled database of 42,734 US zip codes — just pick a state and a business type, and go.

What It Does

Give it a search query (e.g. "dentist") and a location (state, zip codes, or CSV file), and it returns structured data for every matching business:

  • Business name, address, phone number
  • Website domain
  • Star rating and review count
  • Worst review text (lowest-rated review per business)
  • Google Place ID

Results are exported to CSV, deduplicated by business ID.

Included: 42,734 US Zip Codes

The data/us-zip-codes.csv file contains every US zip code with:

Column Example
zip 90210
primary_city Beverly Hills
state CA
timezone America/Los_Angeles
area_codes 310
latitude 34.09
longitude -118.41
irs_estimated_population 15,895

Use --state TX to automatically search every zip code in Texas. Use --min-pop 5000 to skip low-population zips and save API calls.

Setup

1. Get a RapidAPI Key

Sign up at RapidAPI and subscribe to the Google Maps Extractor API. The free tier works for testing.

2. Install

git clone https://github.com/growthenginenowoslawski/google-maps-scraper.git
cd google-maps-scraper
pip install -r requirements.txt

3. Set Your API Key

cp .env.example .env
# Edit .env and paste your RapidAPI key

Or export it directly:

export RAPIDAPI_KEY=your_key_here

Usage

CLI Mode (Recommended)

# All dentists in Texas
python google_maps_zip_scraper.py --query "dentist" --state TX

# Pizza restaurants in California, only zips with 5000+ population
python google_maps_zip_scraper.py --query "pizza restaurant" --state CA --min-pop 5000

# Specific zip codes
python google_maps_zip_scraper.py --query "gym" --zips 90210,90401,91101

# From a custom CSV file with a 'zip' column
python google_maps_zip_scraper.py --query "plumber" --file my_zips.csv

# Custom output path and more workers
python google_maps_zip_scraper.py --query "attorney" --state FL --output attorneys.csv --workers 10

Interactive Mode

Just run it with no arguments:

python google_maps_zip_scraper.py

It will prompt you for a search keyword and how to specify zip codes.

Run in Background (macOS)

For large state-wide scrapes:

nohup caffeinate -i python3 google_maps_zip_scraper.py --query "dentist" --state CA > scraper.log 2>&1 &
tail -f scraper.log

All Options

Flag Description
--query, -q Business type to search (required in CLI mode)
--state, -s 2-letter US state code — searches all zips in that state
--zips, -z Comma-separated zip codes
--file, -f Path to CSV file with a zip column
--min-pop Minimum population filter (use with --state)
--output, -o Output CSV path (default: timestamped file)
--workers, -w Concurrent threads (default: 5)

Output

Results are saved as CSV with these columns:

  • business_name — Name of the business
  • address — Full address
  • phone — Phone number
  • website_domain — Website domain
  • rating — Average rating (1-5)
  • total_reviews — Number of Google reviews
  • zip_code — Zip code that was searched
  • business_id — Google Place ID
  • review_text — Text of the worst review
  • review_rating — Star rating of the worst review
  • review_date — Date of the worst review

Performance

With default settings (5 workers, 10 requests/second rate limit):

  • ~5-10 zip codes per second depending on API response time
  • Progress auto-saves every 1,000 zip codes
  • Businesses are deduplicated across overlapping zip code results

Project Structure

google-maps-scraper/
  data/
    us-zip-codes.csv          # 42,734 US zip codes (bundled)
  google_maps_zip_scraper.py   # Main scraper script
  requirements.txt             # Python dependencies
  .env.example                 # Example environment file
  zip_codes.csv.example        # Example custom zip codes format
  LICENSE                      # MIT

License

MIT — use it however you want.

About

Scrape Google Maps business listings across 42,000+ US zip codes. Includes bundled zip code database with city, state, coordinates, and population data.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages