Allow toArray() method to return indexed columns

Topics: Developer Forum
Mar 10, 2015 at 7:29 PM
Hello,

I think it would be really helpful if the toArray() method could return indexed columns ('1' instead of 'A'). Or maybe have a callback so that I could use this: "PHPExcel_Cell::columnIndexFromString($column);". I would just prefer that, so that I do not have to loop through the array multiple times. Regardless, I've found PHPExcel very helpful already, so thank you in advance.
Coordinator
Mar 10, 2015 at 7:46 PM
The fourth argument for the toArray() method tells PHPExcel whether to do that or not
    /**
     * Create array from worksheet
     *
     * @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
     */
    public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) {