method similar to getSheetNames for cell values?

Feb 24, 2011 at 6:21 PM

I can't find anything in the doc's, and I've been searching the code and have come up empty also...

Is there a method that will simply return all the cell values in an array similar to how the getSheetNames method works?

Feb 24, 2011 at 6:31 PM
Go to "Documentation/PHPExcel developer documentation.doc," and find
section 4.5.5. "Looping cells."

On 2/24/2011 1:21 PM, sinerasis wrote:
> I can't find anything in the doc's, and I've been searching the code and
> have come up empty also...
>
> Is there a method that will simply return all the cell values in an
> array similar to how the getSheetNames method works?
Feb 24, 2011 at 6:38 PM

I was just looking in the wrong place. Thanks Scott.

Coordinator
Feb 24, 2011 at 9:51 PM

Take a look at the toArray() method for the Worksheet. There's a whole host of arguments to determine how you want the data returned, all defined in the API.

  * @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

In the latest SVN code, there's also rangeToArray() and namedRangeToArray() methods.