4

What is the $worksheetId from the Zend GData documentation supposed to be?

http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html

$query = new Zend_Gdata_Spreadsheets_ListQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$query->setWorksheetId($worksheetId);
$query->setSpreadsheetQuery('name=John and age>25');
$listFeed = $spreadsheetService->getListFeed($query);

The documentation uses that $worksheetId several times, but I can't seem to see where to get that from a spreadsheet.

David Souther
  • 8,125
  • 2
  • 36
  • 53

2 Answers2

2

If you don't know the worksheet identifiers, you have to perform a first query to retrieve the worksheets metafeed for your spreadsheet:

$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$feed = $spreadsheetService->getWorksheetFeed($query);

Then, you iterate $feed->entries and each entry will represent a worksheet and have an identifier.

Claudio Cherubino
  • 14,896
  • 1
  • 35
  • 42
0

The $worksheetId is the worksheet identifier. Worksheets have a gid identifier (1,2,....) that you can see directly in the url of the document when is opened.

Unfortunately you can't access to them through API with that id.

Use instead the codes that you find in the following discussion:

Worksheet GIDs

Community
  • 1
  • 1
Giu87
  • 96
  • 5