Is it possible to access the Google Spreadsheets API via an Google API Service account? How to do so in PHP? -


i using google php api service account manipulate google clouddns records this:

$permisson = 'https://www.googleapis.com/auth/ndev.clouddns.readwrite';  $client = new google_client(); $client->setapplicationname("foo");  $credentials = new google_auth_assertioncredentials(     $googleapiserviceaccount,     array($permission),     file_get_contents($googleapikeyfile) );  $client->setassertioncredentials($credentials);  if ($client->getauth()->isaccesstokenexpired()) {     $client->getauth()->refreshtokenwithassertion($credentials); }  $accesstoken = $client->getaccesstoken();  [..] 

is possible use similar scheme google apps spreadsheets access? use $permission , kind of api have enable in google developer console?

please note: aware of fact easy access api via oauth2 - looking way access via service account.

regarding permission part:

$permissions = array(     "https://spreadsheets.google.com/feeds",     "https://docs.google.com/feeds" ); $credentials = new google_auth_assertioncredentials(     $googleapiserviceaccount,     $permissions,     file_get_contents($googleapikeyfile) ); 

and google api console service account needs added collaborator spreadsheet want access! can create/see service account email addresses here:

https://console.developers.google.com/project/your-project-name/permissions/projectpermissions

this service use:

$service = new \google\spreadsheet\spreadsheetservice(); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -