24Mar

Access Google Docs with PHP

Spent almost 2 hours today trying to figure out how to access Google docs using PHP.  Specifically, using a spreadsheet as a way to store data.  Quick and dirty.

On the web you’ll see using the ZEND framework.  At first I was trying hard not to use this, as most shared hosting will not allow you to install frameworks.

Turns out this was an unwarranted fear.   Simply do the following:

1.

Download and extract the following into the same folder:
Zend Framework 1.12.5 Minimal
Zend_Gdata
This is the link to download the frameworks.

Screen Shot 2014-03-24 at 6.06.55 PM

you can use the commands

cp -r “Zend Framework 1.12.5 Minial” “Zend_Gdata”

2.

Grab the sample php code from this site:

Screen Shot 2014-03-24 at 6.05.19 PM
Get the Google_Spreadsheet.php form this link.

Change:

“$_SERVER[DOCUMENT_ROOT]/ZendGdata-1.8.1/library”)”

“$_SERVER[DOCUMENT_ROOT]/{Change this to where you extracted the above zend framework}/library”

3.

Change the following to match your google login credentials and the spreadsheet you made:

$u=”[email protected]
$p=”somepassword”
$ss->useSpreadsheet(“test”)

Screen Shot 2014-03-24 at 6.08.03 PM

4.

Add the column names to that spreadsheet:
name, email, comments

5.

Run the page, and see the new values added.  Credits to : www.farinspace.com, just trying to keep track of how to do things my way.

Share this Story

About Danny

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Copyright 2013, All Rights Reserved