asimlqt / php-google-spreadsheet-client

A PHP library for accessing and manipulating Google Spreadsheets
Other
543 stars 154 forks source link

Editing data from Public Spreadsheet #139

Closed flo62134 closed 3 years ago

flo62134 commented 8 years ago

Hi everyone,

I created a public spreadsheet, allowed it to be edited and seen by everybody. I succeeded in retrieving data but I can't manage to edit data...

This is my code

`<?php

require 'vendor/autoload.php'; use Google\Spreadsheet\DefaultServiceRequest; use Google\Spreadsheet\ServiceRequestFactory; use Google\Spreadsheet\SpreadSheetService;

$serviceRequest = new DefaultServiceRequest(""); ServiceRequestFactory::setInstance($serviceRequest);

$spreadsheetService = new Google\Spreadsheet\SpreadsheetService(); $worksheetFeed = $spreadsheetService->getPublicSpreadsheet('1t5dQFkMafnjHaynHyiH970PWIJO1Jlp2SrDG-AJzXy8');

$worksheet = $worksheetFeed->getByTitle('Feuille 1');

$cellFeed = $worksheet->getCellFeed(); $cell = $cellFeed->getCell(2,2); $cell->update("Yop");`

And this is the result :

Fatal error: Uncaught exception 'Google\Spreadsheet\Exception\BadRequestException' with message '<!DOCTYPE html>Google Drive -- Page Not Found