phpzend-frameworkgdatazend-gdata

Using Zend Gdata spreadsheets to get worksheet id


I am trying to use zend gdata to get the worksheets for a spreadsheet. I am able to get the list of worksheets using

$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($key);
$feed = $spreadSheetService->getWorksheetFeed($query);

I was wondering how I could get worksheetId.

I appreciate any help.


Solution

  • You can cycle through the worksheet ids like this:

    foreach ($feed->entries as $entry)
    {
    
    /*use basename since this outputs a url & the id we need is just the last bit */
    
    $worksheetId = basename($entry->id);
    
    /* do something e.g.*/
    
    echo $entry->title." : ".$worksheetId."\n";
    
    }