Currently, newly created Google spreadsheets seem to default to having 20 columns.
I am able to create new column headers through the cell feed, but only for those existing 20 columns. Beyond that, I cannot create new columns, much less new column headers, as I get the following error:
Expected response code 200, got 403
It looks like someone else already deleted this cell.
Using the Zend GData API, this is what I'm doing:
<?php
/*
* Given:
*
* $columnNames, e.g. array('FirstName', 'LastName', 'DateOfBirth')
* $lastColumnOnSpreadsheet, e.g. 20
* $spreadsheetService
* $spreadsheetKey
* $worksheetId
*/
foreach ($columnNames as $columnName)
{
if (!array_key_exists($columnName, $columnsAlreadyOnSpreadsheet))
{
$spreadsheetService->updateCell(1 /* first row */,
++$lastColumnOnSpreadsheet,
$columnName,
$spreadsheetKey,
$worksheetId);
}
}
?>
So, beyond $lastColumnOnSpreadsheet
being 19, I get the aforementioned error. Currently, the only workaround is to manually insert columns to the right, one by one, which, besides being tedious, kind of destroys the purpose of automation via GData.
Is it possible to insert columns via the GData API? If so, how, in particular through the Zend framework?
Java/.net: This shows how to set the size of the sheet, you can use it to append rows and cols https://developers.google.com/google-apps/spreadsheets/
But I found the OAuth hard. For OAuth I used the GDrive tutorial "DrEdit", is the best OAuth tutorial I have seen.