Skip to content

Instantly share code, notes, and snippets.

@frozonfreak
Created July 28, 2014 04:03
Show Gist options
  • Save frozonfreak/1392a8e40d9e6a9b5974 to your computer and use it in GitHub Desktop.
Save frozonfreak/1392a8e40d9e6a9b5974 to your computer and use it in GitHub Desktop.
Google Spreadsheet reading PHP
$spreadsheet_url="https://docs.google.com/spreadsheet/pub?key=<somecode>&single=true&gid=0&output=csv";
if(!ini_set('default_socket_timeout', 15)) echo "<!-- unable to change socket timeout -->";
if (($handle = fopen($spreadsheet_url, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$spreadsheet_data[]=$data;
}
}
fclose($handle);
}
else
die("Problem reading csv");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment