Answer the question
In order to leave comments, you need to log in
Is it possible to parse data from a Google Sheet every time a php page is opened?
Hello! There is a table (shared) in Google Sheet with prices, you need to pull up these prices on the PHP page. Found this documentation but there it requests user authorization in Google. Is it possible to somehow parse even if the user does not have a Google account?
Or is the only way out is to do server-to-server communication and store the data in a database or json file?
Answer the question
In order to leave comments, you need to log in
Earned, like quickly and without glitches:
<?php
$apiKey="ВашКлюч"; //apikey from GoogleDevConsole/Credentials
include_once 'vendor/autoload.php'; //library
$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey($apiKey);
$service = new Google_Service_Sheets($client);
$spreadsheetId = 'ВашИдДокумунта'; //change to your
$range = 'A1:B';
$response = $service->spreadsheets_values->get($spreadsheetId, $range);
$values = $response->getValues();
if (count($values) == 0) {
print "No data found.\n";
} else {
print "Name, Major:\n";
foreach ($values as $row) {
printf("<p>%s, %s</p>", $row[0], $row[1]);
}
}
?>
Yes, only it loads a little slower than it should, you just need to open this file for everyone, but it turned out that it’s better to store it on your server, I don’t know why data is slowly loaded from Google and sometimes there are some repairs.
$(document).ready(function() { $('#btn1666').hover(function(){ $(this).remove();
$.getJSON('https://www.googledrive.com/host/0B5B...................5QkE4Nnc', function(data) {for(var i=0;i<data.users.length;i++){
$('.canal').append('<br><input type=\"image\" name=\"message\" value=\"'+data.users[i].id+ '\" src=\"'+data.users[i].num+'\"> ' + data.users[i].text + ' <br><br><br>' ).hide().fadeIn(1000);
}
if( i>1){ $('.canal2').html('<br>'+i+ ' - Ролики. Больше... Жми!<br><hr>' ); }
} )} );return false;});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question