I'm uploading an excel file to website and process it for database use.
I'm using toArray()
function to get all rows in a php array.
But I want to skip the first row ( header title row). The rest of rows will be stored in array.
How can I skip the first row.
Note : I can't use rangeToArray()
function since there is not fixed range to get rows into array. It is dynamic. All i want is get all rows except first.
Eko answers half the problem, you can use rangeToArray(); but you don't need to use a loop at all:
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
$sheetData = $sheet->rangeToArray(
'A2:' . $highestColumn . $highestRow,
NULL,TRUE,FALSE
);
Alternatively, use toArray()
and then just unset
the first element from the returned array