Claude 如何用 Google Places API 擷取商業名單並寫入試算表
Free Google Maps Leads Into a Spreadsheet: I Had Claude Build the Scraper
作者用 Claude 在 VS Code 建立基於 Google Places API 的程式,按行業類別和地點搜尋商業名單,並將資料寫入 Google Sheet。
TL;DR: I wanted business leads without paying for a lead database. So I had Claude (running inside VS Code) build a small program on the Google Places API that searches one niche in one location and writes the results into a Google Sheet. I tested it live on plumbers in Italy. The first pass returned company names and websites but no emails. A second prompt got emails plus notes on mistakes on each site, like placeholder text left in a homepage carousel. I didn't send any emails in this run, so there are no reply numbers here.
Why I built this
Most lead tools want a monthly subscription before you've proven your offer works. Google Maps already lists almost every local business with a name, address, phone number and website. I wanted to know if an AI agent could turn that into a usable lead list for me, with me writing almost no code.
The setup
- Claude as the AI. It doesn't really matter which one. Gemini or Codex would work too, but Claude is good at this kind of job.
- VS Code as the place the AI runs. I'm a bit old school. Claude's desktop app or Google Antigravity would also work.
- A Google Cloud project with OAuth set up, so the AI can use Google Sheets (and Drive, Docs, Gmail, YouTube if you want them).
- Google Places API (New) for the actual business search.
- A Google Sheet as the output.
One honest catch: the Places API has a free tier and a paid tier, so Google asks for a credit card when you enable it. My notes said the free tier covers up to 10,000 searches a month. Google says it won't charge unless you change it yourself, and it hasn't charged me anything, because I haven't gone over that. Check Google's current pricing page before you rely on that number, because pricing can change.
Step 1: Write the brief
I pasted in a brief I'd written for an earlier version of this program. The core of it:
- Pick one specific business type or target. If you don't know, ask the AI to suggest one.
- Pick a location. Again, the AI can suggest.
- Use the Google Places API.
- Pull back each business's name, address, phone number, website and other details.
- Filter out the best ones.
- Save everything to a spreadsheet.
The AI also suggested optional add-ons. In my earlier version I'd used two of them. One visits the website to find the owner or manager, plus public info like their LinkedIn or another email. The other analyzes the website and points out something specific about it, so a later email reads like I actually looked at their site.
The only line you really change each time is the niche and location.
Step 2: Connect Google
This part takes the longest, and it's the same flow I showed in an earlier video:
- Go to Google Cloud Console and create a new project. The name doesn't matter.
- Open APIs & Services, then the OAuth consent screen, and click Get started.
- Fill in an app name and support email, choose External, add contact info, and agree to the terms.
- Go to Clients, then Create client, and pick Desktop app because it runs locally.
- Download the JSON file with the client ID and secret. Don't show it to anyone.
- Back in APIs & Services, enable each API you need: Sheets, Drive, Docs, Gmail, and YouTube Data API v3 if you upload.
- Under Data access, add the scopes for those services and save.
- Under Audience, publish the app.
- Tell the AI where the JSON file is. For each Google product, a browser window opens, you sign in, and you click past the "unverified app" warning (Advanced, then continue). That warning shows up because you just created the app yourself.
The one new piece for leads is enabling Places API (New), which is where Google asks for your card.
A tip that saves a lot of frustration: Google moves buttons around. If your screen doesn't match a tutorial, screenshot it or copy the page text and paste it to the AI. It will tell you where to click.
Step 3: Let the AI build it
My prompt was roughly: "Build me this program, but don't consider any of the old stuff on my computer. This is a fresh one for the video."
Claude asked follow-up questions about what I wanted, asked for the Places API key, and asked what to scrape. Meanwhile I made an empty Google Sheet, copied its link, and gave it to the AI. I asked it to connect the sheet and put all the scraped information there.
The first time, the AI checked the sheet through the browser. After that it writes to it directly.
Step 4: Live test on plumbers in Italy
For the demo I told it to target plumbers in Italy. You'd swap in your own niche and country.
It started filling the sheet with company names and websites. But it didn't add emails this time, and I don't know why. So I sent a follow-up:
Please add emails, and look at all those websites. Find something personal to mention in an email, or a mistake on the website that I could offer to fix. Don't write the email yet.
The second pass found emails and added notes per business. Some of the notes:
- The homepage carousel still had placeholder text, so the site looked unfinished.
- No contact form, on more than one site.
I don't read Italian, so I couldn't check every note myself.
Results
| Item | What happened |
|---|---|
| Building the program | Claude built it from my brief and asked follow-up questions |
| Google connection | OAuth desktop app, Sheets connected, browser sign-in once per product |
| Places API cost | Card required. My notes said up to 10,000 free searches a month, and I haven't been charged. |
| First run (plumbers, Italy) | Names and websites in the sheet, no emails |
| Second prompt | Emails found, plus notes on site problems (placeholder carousel text, missing contact forms) |
| Emails sent | None in this run |
| Replies or clients | Not measured |
What failed or needs care
- Emails were missing on the first pass. I had to ask again explicitly. Put emails in the first brief.
- The card requirement. "Free" here means free within Google's quota, and you still have to hand over card details.
- The Google setup is the slow part. The AI-building step was quick. The consent screen, scopes and API toggles take longer, and the buttons keep moving.
- I couldn't verify the notes. The site was in Italian, so the "mistakes" are only as good as the AI's reading of them.
- No outreach yet. A lead list isn't a result. I didn't send anything because I had no real reason to contact plumbers in Italy.
What I'd do next
- Put emails and website notes in the first prompt.
- Spot-check maybe ten leads by hand before trusting the whole sheet.
- Connect Gmail and send a small, plain cold email batch, then track replies before calling it a working system. (I tested that part in a later video.)
Always follow the email marketing, privacy and anti-spam rules where you and your recipients are, and Google's terms for the Places API. Written up from my video with AI help; the test and the opinions are mine.
Full run on video (my channel): https://www.youtube.com/watch?v=5IodNgf4V0E
來源:DEV Community · dev.to