How do I access the Google Spreadsheets API in PHP?

Jo Sprague picture Jo Sprague · Dec 5, 2013 · Viewed 25.3k times · Source

Starting with the Google Developer documentation on the Google Spreadsheets API, I found that "A number of client libraries are provided in various languages.", but Google only provides client libraries for Java and .NET. For a PHP library, they recommend using Zend GData. So, I headed over the the Zend GData repo, and Zend says that their GData component is discontinued, and to use Google APIs Client Library for PHP. That library doesn't work with the Spreadsheets API, for that you have to go back to the original page that I started with.

So, it seems like everyone's passing the buck. I just need to write some PHP code that requests and processes data from a Google Spreadsheet. How do I do that? Please don't link me to similar posts or pages without checking to be sure that they are 100% up to date, I've been sifting through a huge mess of posts for hours that are all full of outdated and deprecated dependencies.

Answer

aman picture aman · May 6, 2014

You can use the PHP Google Spreadsheet Client library.

You'll need to use the Google APIs Client Library for PHP as well to authenticate via OAuth2. Developer documentation is linked on the github page.