asimlqt / php-google-spreadsheet-client

A PHP library for accessing and manipulating Google Spreadsheets
Other
544 stars 152 forks source link

Cant insert row in a spreadsheet #98

Closed IdenGit closed 8 years ago

IdenGit commented 9 years ago

When i try to insert new row in a spreadsheet i catch 'Error in google request' exception.

So i try to find a problem. i'm dump request and found "Blank rows cannot be written; use delete instead" request error message. Maybe throuble in my code? Ok i try to use native example like that

$spreadsheetService = new Google\Spreadsheet\SpreadsheetService(); $spreadsheetFeed = $spreadsheetService->getSpreadsheets(); $spreadsheet = $spreadsheetFeed->getByTitle('MySpreadsheet'); $worksheetFeed = $spreadsheet->getWorksheets(); $worksheet = $worksheetFeed->getByTitle('Sheet 1'); $listFeed = $worksheet->getListFeed();

$row = array('name'=>'John', 'age'=>25); $listFeed->insert($row);

But it isn't work too!

I rewrite my code to use cell api. But it slow. Can you fix this bug?

lauramoraes commented 9 years ago

You have to set the headers first: https://github.com/asimlqt/php-google-spreadsheet-client#adding-headers-to-a-new-worksheet