0

suppose i have a cell in a worksheet that has a value of "last data cell" is this the correct way to get the index of this cell (i.e A5) using Zend GData ?

    $query = new Zend_Gdata_Spreadsheets_CellQuery();
$query->setSpreadsheetKey($this->_spreadsheetKey);
$query->setWorksheetId($worksheet);

$cellFeed = $this->_spreadsheetService->getCellFeed($query);

foreach($cellFeed as $cellEntry) {
      $row = $cellEntry->getCell()->getRow();
      $col = $cellEntry->getCell()->getColumn();
      $val = $cellEntry->getCell()->getText();
      if ($val == 'last data cell'){ $index = array($row, $col); }
      //echo "$row, $col = $val\n";
}
return  $index;

i want to use the $index value later as a boundaries to define a range, like this for example:

$range = (string)$index[0]+1 + $index[1].":F20";
$contentAsCells = $worksheet->getContentsAsCells($range);

but the index value is numeric. how do i convert it to the "A1" format ? thanks

vascowhite
  • 18,120
  • 9
  • 61
  • 77
buzibuzi
  • 724
  • 3
  • 15
  • 27

1 Answers1

0

You can get the cell ID like this:

$cellId = $row . $col; //vars from your code above.
echo $cellId;

If $col is 'A' and $row is 1 this will output

A1

vascowhite
  • 18,120
  • 9
  • 61
  • 77
  • That's strange according to the docblock for Zend_Gdata_Spreadsheets_Extension_Cell::getColumn() it should return a string. – vascowhite Jun 20 '12 at 12:01