Parsing Google Sheets using PHP and JSON

Parsing public and shared Google Sheets as JSON with PHP

// Parsing this spreadsheet: https://spreadsheets.google.com/pub?key=0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc&hl=en&output=html
$url = 'http://spreadsheets.google.com/feeds/list/0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc/od6/public/values?alt=json';
$file= file_get_contents($url);
$json = json_decode($file);
$rows = $json->{'feed'}->{'entry'};
foreach($rows as $row) {
$title = $row->{'gsx$title'}->{'$t'};
$author = $row->{'gsx$author'}->{'$t'};
$review = $row->{'gsx$review'}->{'$t'}; 
echo $title . ' by ' . $author . ' ' . $review; 
echo '<br>'; } // See this here: http://imagine-it.org/google/spreadsheets/showspreadsheet.php

Getting data from other Google Sheets URLs

For sheet 2
https://spreadsheets.google.com/feeds/list/1ppywkX1g_0ynTIs6qQvCMzsandxLqMUHFDR0SQyjvtA/2/public/values?alt=json
For sheet 3
https://spreadsheets.google.com/feeds/list/1ppywkX1g_0ynTIs6qQvCMzsandxLqMUHFDR0SQyjvtA/3/public/values?alt=json

[ Original Spreadsheet
https://docs.google.com/spreadsheets/d/1ppywkX1g_0ynTIs6qQvCMzsandxLqMUHFDR0SQyjvtA/edit#gid=1
]

 

Visit sunny St. George, Utah, USA

Get In Touch

We would love to hear from you.

Please enter your email address.
Please enter a valid email address.
Please enter the verification number.
You have entered a wrong verification number.
Please enter a message.
Please check your message for any errors.
Your message has been sent successfully.
Sorry, error occured this time sending your message.
* required