I have been using the following code (found here, seems to be popular around the internet) to download and use a CSV-file from a Google Drive Sheet:
$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");
However, this script stopped working for me a few weeks ago. The link downloads the CSV-file just fine if done manually, but no longer happens using the script.
Has anyone had this problem and found a solution? Otherwise, what other option works? I cannot get the "official way" to work (it's just stuck in "Enabling API..." forever), and I hear many others can't get this to work either.