Skip to main content

Command Palette

Search for a command to run...

How to extract data from Google maps using Golang

Updated
G

I am a software engineer based in Cyprus with over 20 years of experience in the industry. My background in Computer Science has led me to work with PHP, Python, and more recently, with a focus on Golang.

Originally from Greece, my career has taken me across Europe, and I now call Cyprus home. I've attended numerous conferences, continually expanding my knowledge and network.

Recently, I started blogging to share my insights and experiences with the tech community. I'm passionate about engaging with fellow developers and contributing to the field through my writing and future projects.

Thank you for visiting my blog.

This post introduces a command-line application that allows you to extract data from Google Maps.

If you want to extract to collect some data for local businesses using Google Maps then this tool is for you.

The tools retrieve and export to a CSV file the following data:

  • Title: the title of the business

  • Category: the category of the business

  • Address: the address of the business

  • OpenHours: the opening hours of the business

  • Website: the website of the business

  • Phone: the phone number of the business

  • PlusCode: the plus code of the business

  • ReviewCount: the number of reviews

  • ReviewRating: the rating of the results

Getting started

  1. create a file with your queries like:

     bars in Athens
     doctor in Berlin
     doctor in Bonn
    
  2. Make sure you have Docker installed

  3.  docker run -v $PWD/example-queries.txt:/example-queries -v $PWD:/results gosom/google-maps-scraper -depth 1 -input /example-queries -results /results/result-file.csv
    
  4. wait for it to finish. The program does not exits automatically. When there are no updates in the console for some time you can hit CTRL-C. Meanwhile you will see that the file result-file.csv will be populated

  5. Results will be to the file result-file.csv

Notes: Please adjust the filenames to the desired ones.

Conclusion

In this blog post, I introduced google-maps-scraper command line tool.

The tool is built using the Go programming language and it uses scrapemate .

All the code is on Github. Feel free to create an Issue or leave a comment here if you run into problems or you have some ideas for extension.

C

Good afternoon, man. I want to reproduce this on my computer (Windows 11) but I'm having some difficulty. Despite having some familiarity with programming languages, I am a complete layman when it comes to databases and Docker. Can you help me with my attempt to reproduce it on my machine?

G

Hi Caio,

If you experience an issue I recommend you create an issue in github with more details and I will try to assist.

https://github.com/gosom/google-maps-scraper/issues/new