Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Phillip Shipley:
Read and write Google Sheets from PHP
Jun 01, 2017 @ 15:57:44

Phillip Shipley has written up a post for his site walking you through the process of using PHP to read from and write to Google Sheets via the Google Sheets API.

This past week I needed to be able to read some data from a Google Sheet and then update a column for each row after processing it. This sort of thing should be simple, Google is built on APIs and has client SDKs for just about every language. I’ve also integrated with several Google Admin APIs previously so I expected this to be a breeze. I was wrong.

I started out by reading the Quickstart for Sheets API with the PHP Client, but almost immediately I could tell it was not written for my use case. [...] My use case is to use a backend process to function as a service account and batch process data. So the whole API credentials process was wrong for me.

He tried a few different approaches and finally, after some guessing, discovered how to share a sheet with the email address for the application. He then includes the steps to follow to get this same setup configured for your application and the code (using the Google_Client) to read and write to the sheet.

tagged: read write google sheets tutorial client sharing

Link: http://www.phillipshipley.com/2017/05/read-and-write-google-sheets-from-php/


Trending Topics: