I am using PHPExcel to read some data from an xls
file.
I want to get a couple of cells at once, say: A6 - A11.
I know I can use $cell = $objPHPExcel->setActiveSheetIndex(0)->getCell('A6');
to get a single cell, and I could probably loop through an array and get each cell in my range.
But, isn't there a simpler method to get a range of cells something like getCellRange('A6:A11')
?
There is, the rangeToArray()
method:
$objPHPExcel->setActiveSheetIndex(0)->rangeToArray('A1:C3');
Wondering why I bother documenting these methods in the first place, but here's the argument list as well:
/**
* Create array from a range of cells
*
* @param string $pRange Range of cells (i.e. "A1:B10"),
* or just one cell (i.e. "A1")
* @param mixed $nullValue Value returned in the array entry
* if a cell doesn't exist
* @param boolean $calculateFormulas Should formulas be calculated?
* @param boolean $formatData Should formatting be applied to cell values?
* @param boolean $returnCellRef False - Return a simple array of rows
* and columns indexed by number counting
* from zero
* True - Return rows and columns indexed by
* their actual row and column IDs
* @return array
*/