Category Archives: Google

How to write to Google Sheet with API in PHP

  1. Get a service account key from https://console.cloud.google.com/apis/credentials (You can here also restrict what this keys is allowed todo)
    1. When creating, make sure you click the Furnish a new private key
    2. Select JSON when it asks you how to download the key.
  2. The service account key you have just generated includes a client_email.
    1. Go to you google spreadsheet and allow this client_email to have write access on this document

https://stackoverflow.com/questions/44045183/access-google-spreadsheet-api-without-auth-token

Finding the Google Places Reference String

The illusive Reference String. A client needed to pull their reviews from google and after research I found out that I needed to use the getDetails() method to gather this information. Upon going to their API docs, I was left with this

This method takes a request, containing the desired Place’s reference value.
If only they told you how to get the value…ugh… After playing around with it, I found that the textSearch() method included this value in its response. I put together a client side script that uses a jQuery geocomplete plugin to get the lat/lng to pass the textSearch() method to retrieve the Reference String. You only need to know the address of place you are searching for.

I am not going to provide the script for it, but if you view source you can pull the appropriate code. ——> Find Google Places Reference String Now