Set “publish to web” in Google spreadsheet using Drive API (PHP) -


i trying use google drive api set google sheet "publish web" mode can embed on website.

using drive api in php:-

// api client , construct service object. $client = getclient(); $service = new google_service_sheets($client);  $driveservice = new google_service_drive($client); /* $copiedfile = new google_service_drive_drivefile(array('name' => 'project plan')); $responsebody=$driveservice->files->copy("1hajkeox4hhlk4aocvluuvftjbkphfklg1gg9-hsgh7u", $copiedfile); $sheet_id=$responsebody->id; */ $sheet_id="1tyktonmpaaxgas5ylnn8ntzpjtdesuyidhakhap8amk"; $revisions=$driveservice->revisions; $sheetinformation =$revisions->listrevisions("1tyktonmpaaxgas5ylnn8ntzpjtdesuyidhakhap8amk"); $revisions=$sheetinformation->getrevisions(); $count=count($revisions); $revision_id=$revisions[$count-1]->id; $finalrevision=$driveservice->revisions->get($sheet_id,$revision_id); $finalrevision->publishauto=true; $driveservice->revisions->update($sheet_id,$revision_id, $finalrevision);  die(); 

as far can tell conforms drive api specification (i wish hadn't removed code examples php!). however, getting following error returned in response body:-

"error": {   "errors": [    {     "domain": "global",     "reason": "fieldnotwritable",     "message": "the resource body includes fields not directly writable."    }   ],   "code": 403,   "message": "the resource body includes fields not directly writable."  } } 

any appreciated!


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -