php-google-spreadsheet-client icon indicating copy to clipboard operation
php-google-spreadsheet-client copied to clipboard

A working example and Google Errors!!!

Open raygig opened this issue 8 years ago • 3 comments

I have spent a few hours now trying to get the examples in this repo to work and keep runnning into issues.

My latest one is an error from Google We're sorry. This document is not published.

Not sure why this is happening because I am using a valid access token. Regardless, I then published the document and then was prompted with another error.

Sorry, unable to open the file at this time. Please check the address and try again.

Is anyone else pulling out there hair as I am?

Doc URL: https://docs.google.com/spreadsheets/d/1tftyNypXdc6bX3EIXH3kG49AV14irkHaxgm6K81jssQ/edit#gid=0

$serviceRequest = new DefaultServiceRequest($accessToken["access_token"]);
$serviceRequest->setSslVerifyPeer(false);
ServiceRequestFactory::setInstance($serviceRequest);


/*
$serviceRequest = new DefaultServiceRequest("");
$serviceRequest->setSslVerifyPeer(false);
ServiceRequestFactory::setInstance($serviceRequest);
*/

$spreadsheetService = new Google\Spreadsheet\SpreadsheetService();
$worksheetFeed = $spreadsheetService->getPublicSpreadsheet("1tftyNypXdc6bX3EIXH3kG49AV14irkHaxgm6K81jssQ");
$worksheet = $worksheetFeed->getByTitle('Sheet1');

$cellFeed = $worksheet->getCellFeed();

$batchRequest = new Google\Spreadsheet\Batch\BatchRequest();
$batchRequest->addEntry($cellFeed->createCell(2, 1, "111"));
$batchRequest->addEntry($cellFeed->createCell(3, 1, "222"));
$batchRequest->addEntry($cellFeed->createCell(4, 1, "333"));
$batchRequest->addEntry($cellFeed->createCell(5, 1, "=SUM(A2:A4)"));

$batchResponse = $cellFeed->insertBatch($batchRequest);

raygig avatar Oct 16 '16 18:10 raygig

Facing the same issue @Luki93 please advise

ray-kay avatar Mar 20 '18 04:03 ray-kay

I got scared about deprecation of v3 the other day and just started rebuilding for v4 without this library, it's not as hard as it seems, but a v4 update of this would be amazing by comparison.

elstiko avatar Mar 20 '18 05:03 elstiko

I did look into updating this library to v4 quite a while back when it was released but I realized that the google php sdk was so easy to use and I didn't know what I could add to make it any easier.

I only got as far as doing the authentication, which to be fair does require a bit of work and could be simplified but after that I didn't know what else I could do :)

@elstiko Since you've worked with v4 do you have any suggestions what could be improved?

asimlqt avatar Mar 25 '18 18:03 asimlqt