I trying to get data from google sheets. but what problem i face is Google_client not found. Php version is updated and i do have client.php in my apiclient/src/google
Fatal error: Uncaught Error: Class 'Google_Client' not found in C:\xampp\htdocs\TestCalon\calonan.php:3 Stack trace: #0 {main} thrown in C:\xampp\htdocs\TestCalon\calonan.php on line 3
<?php
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . __DIR__ . '/client_secret.json');
$client = new Google_Client;
$client->useApplicationDefaultCredentials();
$client->setApplicationName("Something to do with my representatives");
$client->setScopes(['https://www.googleapis.com/auth/drive','https://spreadsheets.google.com/feeds']);
if ($client->isAccessTokenExpired()) {
$client->refreshTokenWithAssertion();
}
$accessToken = $client->fetchAccessTokenWithAssertion()["access_token"];
ServiceRequestFactory::setInstance(
new DefaultServiceRequest($accessToken)
);
$spreadsheet = (new Google\Spreadsheet\SpreadsheetService)
->getSpreadsheetFeed()
->getByTitle('Copy of PRU14 Calon');
// Get the first worksheet (tab)
$worksheets = $spreadsheet->getWorksheetFeed()->getEntries();
$worksheet = $worksheets[0];
$listFeed = $worksheet->getListFeed();
/** @var ListEntry */
foreach ($listFeed->getEntries() as $entry) {
$representative = $entry->getValues();
}
$cellFeed = $worksheet->getCellFeed();
$rows = $cellFeed->toArray();
return $worksheet->getCsv();