Use Google Places API to find a company, its address, phone and URL

Hey hey! :sunglasses:

Some of you have been talking to us about enriching and cleaning up data. Jobs in lead generation us it a lot, but if you don’t know what lead gen is, read on anyway. It’s cool what this app does!

There’ are a few steps to build this. First, you’ll have to activate the Google Maps Platform integration in dashdash’s Integrations menu by storing your Google API key there. This is how the app will look like in the end:

Cells where stuff is happening

A2: "McDonalds, Berlin"     //the company you want to search
B2: =iferror(parse(place_search_google(A2),"place_id"),"not found")
C2: =iferror(place_detail_google(B2),"not found")
D2: =iferror(parse(C4,""),"not found")
E2: =iferror(parse(C4,"result.formatted_address"),"not found")
F2: =iferror(parse(C4,"result.formatted_phone_number"),"not found")
G2: =iferror(parse(C4,""),"not found")

What’s going on on the block above? :thinking: Lets see:

  • B2 has a 3 functions. A PLACE_SEARCH_GOOGLE that calls Google Places API/ Web Service/ Place Search/ Text Search, where you can provide an imprecise search term (its the query= part) and get very nice places that exist on Google! :face_with_raised_eyebrow::money_mouth_face::astonished: The second part, is a PARSE on this response to the PLACE_SEARCH_GOOGLE, which is filtering just the variable place_id inside first result (results[0].place_id); this will return the unique identifier for that result, so that we can do more stuff in another Google API. The last function is just the IFERROR that returns a nice message in case the API request fails or doesn’t return any results.
  • C2 also includes IFERROR, same as above. Apart from it, the PLACE_DETAIL_GOOGLEis calling Google Places API/ Web Service/ Place details, where we provide Google with a place_id and it’ll give us all the info it has on that place. Beautiful :star_struck:.
  • D2 through G2 are fetching individual parts of the response in C2 with PARSE.

And that’s all folks!

If you want to directly talk with the Google Places API without our integration, you can do that, too:

B2: =iferror(parse(get(""&$H$1&"&query="&A4),"results[0].place_id"),"not found")
Y C2: =iferror(get(""&B4&"&key="&$H$1),"not found")

(assuming you store your API key in H1)