Skip to content

dcneiner/GData-to-JSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Spreadsheet to PHP Array/JSON Converter

This is something I patched together because I needed a simple exporter from Google Docs Spreadsheet to JSON/PHP Array. I will build on it over time, but it is not actively maintained. It is released here if it helps someone doing the same thing.

Setup

Copy events-importer/config.sample.php to events-importer/config.php and edit it to provide your credentials for Google Docs. (Note, do not use this method to access other people's accounts. Google provides an authentication process for those users so you don't need to ask for their credentials.)

Use

There is basically two primary steps before you can get data out of a Worksheet:

  1. At the command line, run import.php with the list command. It should list out all accessible spreadsheets in your account and give you the special key for working with it.

     php -f import.php list
    
  2. Next, list out the worksheets in the selected spreadsheet. You use the key obtained from step 1 (Where XXXXXXX is in the following example).

     php -f import.php list-worksheets XXXXXXXXXXXXXXXXXXXX
    
  3. Finally, you can either get JSON with these details, or a PHP array (ob1 should be replaced with the correct worksheet id).

     php -f import.php export XXXXXXXXXXXXXXXXXXXX ob1 > spreadsheet.json
    

Or via PHP (Which returns a PHP associative array)

<?php
    $spreadsheet = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
    $worksheet   = "ob1";
    $data        = include 'import.php';

License

Copyright 2010 by Douglas C. Neiner

Dual licensed under the MIT or GPL license. Included is the Zend GData library which has its own license.

About

A simple PHP script built on the Zend GData library for exporting a spreadsheet to JSON or PHP Array

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages