nice to have PHPExcel_Worksheet::getCells()

Topics: User Forum
Jun 10, 2010 at 3:50 PM
Edited Jun 10, 2010 at 3:51 PM

Hi there,

is there a way to retrieve an array of cells, given an iterval?

Something like:

$cells = array() ;
$objPHPExcel = PHPExcel_IOFactory::load( 'file.xlsx' );
$cells = $objPHPExcel->getActiveSheet()->getCells( A1:C3 );

 

Coordinator
Jun 10, 2010 at 4:11 PM
Edited Jun 10, 2010 at 4:13 PM
echo '<hr /><pre>';
$range = 'A1:B2';
$sheet = $objPHPExcel->getActiveSheet();
$rangeSet = PHPExcel_Calculation::getInstance()->extractCellRange($range,$sheet);
var_dump($rangeSet)
echo '</pre><hr />';

Notes:

$range must be passed as a variable

$sheet must be passed as a worksheet object