Closed yougotashovel closed 8 years ago
Hi,
What do you mean by the page breaks? what error are you getting?
Here are some checks:
Hope that helps.
Hey thanks for the reply.
I already have spreadsheet api installed using composer, required autoload, and i'm using oauth 2.0.
How do i specify the feeds scope?
Any elements i had on my page stop rendering after that point in the code, so there's something in that part of the code causing an error. I just enabled errors and am getting the following:
Fatal error: Uncaught exception 'Google\Spreadsheet\UnauthorizedException' with message 'Access token is invalid' in /Applications/MAMP/htdocs/project/vendor/asimlqt/php-google-spreadsheet-client/src/Google/Spreadsheet/DefaultServiceRequest.php:250 Stack trace: #0 /Applications/MAMP/htdocs/project/vendor/asimlqt/php-google-spreadsheet-client/src/Google/Spreadsheet/DefaultServiceRequest.php(132): Google\Spreadsheet\DefaultServiceRequest->execute(Resource id #35) #1 /Applications/MAMP/htdocs/project/vendor/asimlqt/php-google-spreadsheet-client/src/Google/Spreadsheet/SpreadsheetService.php(38): Google\Spreadsheet\DefaultServiceRequest->get('feeds/spreadshe...') #2 /Applications/MAMP/htdocs/project/quickstart.php(106): Google\Spreadsheet\SpreadsheetService->getSpreadsheets() #3 {main} thrown in /Applications/MAMP/htdocs/project/vendor/asimlqt/php-google-spreadsheet-client/src/Google/Spreadsheet/DefaultServiceRequest.php on line 250
Its saying the access token is invalid, but it seems to be working fine when not using this library.
Do you have any suggestions to what's going wrong?
Thanks
Do you have google spreadsheet enabled in the Google developer console for the account you're using?
Elaborating upon arafatsky99 's answer.
Give edit permission to "client_email" field value in client_secret.json file by opening the actual spreadsheet, refer image.
I've used just the google api and managed to display a list of files that are in my drive, but beyond that i can't find any examples of how to actually access and display cell data. Just the basic meta about the file.
So I found this project, but i can't get it to actually do anything, the php code just breaks after a certain line.
I've got my accessToken, and i put this code into the php file:
Everything is fine, but as soon as i add:
The page breaks.
All i want to do is access a private sheet and loop through the rows in the sheet, so i can display the data on a page.
It would be great if anybody reading this could help me out, i've been going round in circles looking for examples and support.
Thanks