开发者

Zend GData Spreadsheets Add Column Name

Been hunting google, the google docs and the zend docs for this but without much success. I'm trying to add data to a Google spreadsheet using the API and Zend GData. I've succesfully grabbed my spreadsheet and worksheet keys and can update the existing rows without problem.

In short the project requires me to add furth开发者_运维百科er column for the previous months data and this is were my problem starts. I can update the existing data for each row OK but when I try to add a new "column" to the spreadsheet nothing happens. The existing data is updated for the new information does not get inserted.

My code at present is as follows (assuming I already have the spreadsheet and worksheet key):

$query = new Zend_Gdata_Spreadsheets_ListQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$query->setWorksheetId($worksheetId);
$listFeed = $spreadsheet->getListFeed($query);

//$rowData = $listFeed->entries;

foreach ($listFeed as $listEntry) {
    $rowData = $listEntry->getCustom(); 
    $newRow = array();
        //Populate the row data
    foreach($rowData as $field) {
        $newRow[$field->getColumnName()] = $field->getText();
    }
    //Add an array key for the new column       
    $newRow['aug2011'] = 'Some data here';
        $spreadsheet->updateRow($listEntry, $newRow)
}   

exit();

This is beginning to drive me potty with a lack of documentation so any pointers would be greatly received!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜