« Return to Thread: Spreadsheet Demo

Spreadsheet Demo

by Ken Chau :: Rate this Message:

Reply to Author | View in Thread

Am I safe to assume that from now on we have to hardcode in the 5th element after a "/" delimited split to get spreadsheet keys?

This is straight from the demo Gdata Spreadsheet app:

$currKey = split('/', $feed->entries[$input]->id->text);
$this->currKey = $currKey[5];
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($this->currKey);
$feed = $this->gdClient->getWorksheetFeed($query);
$input = getInput("\nSelection");
$currWkshtId = split('/', $feed->entries[$input]->id->text);
$this->currWkshtId = $currWkshtId[8];

Oh, and also don't forget the 8th element after a "/" delimited split on the worksheet entry id object getText() method call!!!!!!!!!!!!!!!!!!

We are treated with such useful classes as:
class Zend_Gdata_App_Extension_Id extends Zend_Gdata_App_Extension
{

    protected $_rootElement = 'id';

    public function __construct($text = null)
    {
        parent::__construct();
        $this->_text = $text;
    }
}


What the community really needs is this:

$service = new Zend_Gdata_Spreadsheet();

$spreadsheets = $service->getSpreadsheets();

foreach($spreadsheets as $spreadsheet) {
  foreach($spreadsheet->getWorksheets() as $worksheet) {
    print_r($worksheet->getCellValue(...)); // just prints out the values in the worksheet
  }
}

I seem to recall PEAR has an Excel reader library that is more elegant than the Gdata Spreadsheet interface.

 « Return to Thread: Spreadsheet Demo