Google sheets API if I understand correctly Authorization?

There is a MySql table just want to transfer data from it to Google sheets, but I'm confused c Google_Client.
For this I can use only API key?

Using API Keys
https://developers.google.com/api-client-library/p...
When calling APIs that do not access private user data, you can use simple API keys.


my code is not working for example, at least to the cell values.
require_once __DIR__ . '/vendor/autoload.php';

$client = getClient();

$service = new Google_Service_Sheets($client);

// The ID of the spreadsheet to retrieve data from.
$spreadsheetId = 'id of my excel file'; // TODO: Update placeholder value.

// The A1 notation of the values to retrieve.
$range = 'page name excel'; // TODO: Update placeholder value.

$response = $service->spreadsheets_values->get($spreadsheetId, $range);

// TODO: Change code below to process the `response` object:
echo '<pre>', var_export($response, true), '</pre>', "\n";

function getClient() {
 $client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
 $client->setDeveloperKey("my api key");
 return $client;
}
?>


using quickstart.php
https://developers.google.com/sheets/api/quickstar...
all easy to get, but I want to understand how to do it using console.developers.google.com/apis creating there api key
March 23rd 20 at 19:02
1 answer
March 23rd 20 at 19:04
https://console.developers.google.com/apis/credentials
clicking the Create credentials > API key in Console
the key I created and framed in the function (gives an error), but did I understand correctly that with only one API key, you can substitute the data into an excel spreadsheet? - clotilde_Treutel commented on March 23rd 20 at 19:07
@clotilde_Treutel, exel not to work with the api - Elsa_Mill commented on March 23rd 20 at 19:10

Find more questions by tags Google SheetsAPIPHP