Reputation: 5463
I am using the library PhpExcel to import data from Excel.
I would like to remove all formatting from the spreadsheet so I can ready the values with the RangeToArray function.
OR
I'd like to read a range values but it seems that rangeToArray takes into account the formatting.
How can I do ?
Thanks a lot,
Upvotes: 1
Views: 3744
Reputation: 212522
If you look at the arguments for the rangeToArray()
method, you'll see that it takes formatting into account by default
/**
* 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
*/
public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
But that you can change that behaviour simply by passing a boolean false
as the fourth argument
Upvotes: 3