2

Retrieving spreadsheet content using for a specific spreadsheet isn't that hard:

$key = 'txSLYk4BpIQaglM38cJbTNA'; // key for a specific spreadsheet
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($key);
$feed = $spreadSheetService->getWorksheetFeed($query);
$entries = $feed->entries[0]->getContentsAsRows();
var_dump($entries); // dumps the spreadsheet content

Can I do the same for a specific text document? The Zend_Gdata_Docs_Query class doesn't have a ->setDocumentKey($key) or equivalent...

/ Jonas

Charles
  • 50,943
  • 13
  • 104
  • 142
Cambiata
  • 3,705
  • 9
  • 35
  • 45

1 Answers1

-1

(note: I haven't worked with ZF's GData API myself... this is speculative, based on browsing through the API)

It looks like you can call Zend_Gdata_Docs::getDoc() - this will return a Zend_Gdata_Docs_DocumentListEntry which in turn exposes a getContent() method.

So:

$docsApi  = new  Zend_Gdata_Docs();
$document = $docsApi->getDoc('key-goes-here', 'document');
$content  = $document->getContent(); // Returns the ATOM content
// OR...
$content  = $document->getDOM(); // Returns a DOM for the content

It looks like the spreadsheet is a more specialised form of this more generic way of retrieving Google Docs content.

kander
  • 4,226
  • 1
  • 22
  • 43
  • 1
    Hmm.. It looks like it's only possible to get document metadata using these methods, not the document content itself. – Cambiata Jan 12 '11 at 15:31