In lesson 5.9 you learned how to scrape leads manually with Claude Code. This lesson turns that into an automated system. One command, 50 scored prospects land in your Google Sheet automatically. Run it every Monday morning and never worry about finding clients again.

📦 Download the Tool

Download the zip, unzip it into your Claude Code project folder, and you're ready to go. Claude reads the instructions automatically and sets everything up for you.

📥
Download Lead Scraper
lead-scraper.zip — 6 KB
Includes: scrape.py, INSTRUCTIONS.md, README, requirements.txt, prospects/ folder

After downloading:

  1. Unzip the folder into your Claude Code project
  2. Open it in Claude Code (VS Code)
  3. Tell Claude: "Read lead-scraper/INSTRUCTIONS.md and set up the lead scraper for me. Make the search function work with real web search."
  4. Claude reads the INSTRUCTIONS.md automatically and configures everything
  5. Run: python scrape.py "dentists" "Tampa, FL"

💡 The INSTRUCTIONS.md file is the magic. When you tell Claude to read it, it and knows exactly what to do. It'll make the search function work with real data, set up Google Sheets if you want, and walk you through everything.

⚡ Manual vs Automated

Lesson 5.9 (Manual)

  • Paste a prompt into Claude Code
  • Claude gives you a markdown table
  • You copy it into a spreadsheet
  • Add tracking columns yourself
  • Repeat every week manually

Lesson 5.10 (Automated)

  • Run one command in Claude Code
  • Claude builds the scraping script for you
  • Prospects go directly to Google Sheets
  • Pre-formatted with scores and tracking
  • Schedule it to run every Monday automatically

⚠️ Do lesson 5.9 first. You need to understand the manual process before automating it. If you haven't done 5.9 yet, go back and do it. Automation without understanding is a mess.

🔄 How the System Works

You're going to ask Claude Code to build you a tool. Here's what the tool does:

1
You type a command Example: python scrape.py "dentists" "Tampa, FL"
2
The script searches for businesses Pulls name, phone, website, address, Google rating, review count from web search results
3
Checks the Meta Ad Library Sees which businesses are running Facebook/Instagram ads and how many
4
Scores each prospect 1-5 Same scoring from 5.9 (5 = bad ads = easiest close, 1 = no presence = skip)
5
Pushes everything to Google Sheets New tab for each scrape. Pre-formatted with outreach tracking columns. Sorted by score.

🛠️ Step 1: Ask Claude Code to Build the Tool

Open Claude Code and paste this prompt. Claude will build the entire scraping tool for you.

Build me an automated lead scraping tool for my ad agency. Here's exactly what I need:

1. A Python script called scrape.py that takes two arguments: a niche and a city
   Example usage: python scrape.py "dentists" "Tampa, FL"

2. The script should:
   - Search the web for 50 businesses matching that niche and city
   - For each business, collect: name, phone number, website URL, address, Google rating, number of reviews, whether they have a Facebook page
   - Check the Meta Ad Library to see if each business is running Facebook/Instagram ads
   - Score each prospect 1-5:
     * 5 = running ads that look low quality (easiest to close)
     * 4 = running ads, decent quality
     * 3 = has Facebook page but no ads
     * 2 = no Facebook page but good reviews (3.5+ stars)
     * 1 = no online presence
   - Filter out businesses with less than 3.5 stars or fewer than 20 reviews
   - Sort by score (highest first), then by rating

3. Output the results to Google Sheets:
   - Connect to Google Sheets API using a service account
   - Create a new tab named "[City] - [Niche] - [Date]"
   - Columns: Score, Business Name, Phone, Website, Address, Rating, Reviews, Facebook Page, Running Ads, Number of Ads, Ad Quality Notes, Outreach Date, Response, Notes, Follow-Up Date
   - Format the header row bold with a light blue background
   - Auto-resize columns to fit content
   - Also save a local CSV backup in a prospects/ folder

4. Include a README with:
   - How to set up Google Sheets API credentials (step by step for beginners)
   - How to run the script
   - How to change the Google Sheet ID

5. Include a requirements.txt with all dependencies

Make sure the script handles errors gracefully. If it can't find info for a business, leave that field blank instead of crashing. Print progress to the terminal so I can see it working.

Create everything in a folder called lead-scraper/
📸 SCREENSHOT: Claude Code building the scraping tool

Screenshot will be added here

💡 Claude builds the whole thing. You don't need to write any code. Claude creates the script, the README, the requirements file, everything. You just paste the prompt and let it work.

📊 Step 2: Connect Google Sheets

The script needs permission to write to your Google Sheet. Claude's README will walk you through this, but here's the overview:

Create a Google Sheet

Go to sheets.google.com and create a new spreadsheet. Name it something like "Agency Prospects". Copy the Sheet ID from the URL (the long string of letters and numbers between /d/ and /edit).

Set Up Google API Credentials

Go to console.cloud.google.com. Create a project, enable the Google Sheets API, and create a service account. Download the JSON key file.

If this sounds confusing, don't worry. Just tell Claude Code:

Walk me through setting up Google Sheets API credentials step by step. I'm a complete beginner. Tell me exactly what to click.

Share the Sheet

Share your Google Sheet with the service account email (it looks like something@your-project.iam.gserviceaccount.com). Give it Editor access.

Add Your Sheet ID to the Script

Open the config file Claude created and paste your Sheet ID. That's it. The script now has permission to write to your spreadsheet.

📸 SCREENSHOT: Google Sheet with prospect data populated by the script

Screenshot will be added here

▶️ Step 3: Run the Scraper

Install the dependencies and run it:

cd lead-scraper
pip install -r requirements.txt
python scrape.py "dentists" "Tampa, FL"

You'll see progress in the terminal as it finds businesses, checks the Ad Library, and scores each one. When it's done, open your Google Sheet. Fresh tab with all your prospects.

More examples:

python scrape.py "HVAC companies" "Phoenix, AZ"
python scrape.py "med spas" "Miami, FL"
python scrape.py "gyms" "Austin, TX"
python scrape.py "roofing contractors" "Dallas, TX"

💡 Run it for multiple niches. Each run creates a new tab in your Google Sheet. By the end of the week you could have 200+ prospects across 4 different niches, all scored and organized.

📅 Step 4: Schedule It (Optional)

Want it to run every Monday morning automatically? Ask Claude Code:

Set up a weekly schedule so my lead scraper runs automatically every Monday at 8 AM. I want it to scrape these niches and cities:

1. "dentists" in "Tampa, FL"
2. "HVAC companies" in "Tampa, FL"  
3. "med spas" in "Tampa, FL"

Each one should create a new tab in my Google Sheet. Send me a notification when it's done (email or Slack or Discord, whatever is easiest to set up).

Claude will set up a cron job (Mac/Linux) or Task Scheduler (Windows) to run the script on a schedule. You wake up Monday morning with 150 fresh prospects in your Google Sheet.

⚠️ Your computer needs to be on. The schedule runs on your machine. If your laptop is closed Monday morning, it won't run. If that's a problem, ask Claude to set it up on a free cloud service instead (like a GitHub Action or a small server).

📞 Step 5: Work the List

The automation gets you the list. YOU still do the outreach. That's where the money is.

1
Monday morning: review your fresh sheet Sort by Score 5 first. Those are businesses running bad ads. Start there.
2
Quick-check their ads in Meta Ad Library Spend 30 seconds per prospect. Note what's bad about their ads. That's your opener.
3
Send personalized outreach to your top 15 Use the templates from lesson 5.9. Mention their specific ads or competitors.
4
Update the tracking columns in your Sheet Mark outreach date, response, and schedule follow-ups for Wednesday.
5
Follow up Wednesday and Friday Most replies come on the 2nd or 3rd touch. Don't skip follow-ups.

🛑 Don't automate the outreach. Scraping is fine to automate. Outreach is not. Personalized messages from a real person convert. Mass-blasted AI messages get ignored and can get your accounts flagged.

🔧 If Something Breaks

Just ask Claude Code to fix it. Copy the error and paste it:

I ran the scraper and got this error: [paste the error here]

Fix it and explain what went wrong.

Common issues:

"Google Sheets permission denied"

You forgot to share the sheet with the service account email. Go back to Step 2.

"Module not found"

Run pip install -r requirements.txt again. A dependency didn't install.

"Rate limited" or "Too many requests"

You're searching too fast. Tell Claude to add a delay between searches (2-3 seconds per business).

"Script found 0 businesses"

Your niche or city might be too specific. Try a broader search ("restaurants" instead of "Italian restaurants") or a bigger city.

☑️ Homework Checklist

Automation Progress 0 / 0 complete

🏷️ Tags

automationlead-scrapingclaude-codegoogle-sheetsprospectingadvanced