I'm trying to import Excel-data by Laravel Excel ( http://www.maatwebsite.nl/laravel-excel/docs ). I'm using Laravel 4.2.
But i only get the first column of the row in the result, seems strange to me, and I get figure out why.
Excel::selectSheetsByIndex(0)->load("fileName.xlsx", function($reader) {
$reader->skip(14);
dd($reader->first());
});
I get this result:
object(Maatwebsite\Excel\Collections\CellCollection)#19057 (2) {
["title":protected]=> NULL ["items":protected]=> array(2) {
["flik_1_personal"]=> string(7) "Annika " [0]=> NULL
}
}
Since the Excel-file looks lite this (the row):
I expected to get all the cells however this is not the case. Does anyone know why this is happening? Thanks!
Update Looks like it's because I don't have any "headers" for the other cells (except first name, which is shown in the result). Is there a setting for getting the cells value, without "headers"?
try this
Excel::selectSheetsByIndex(0)->load($file, function($reader) {
foreach ($reader->toArray() as $row) {
$bb[] = $row;
}
echo '<pre>';print_r($bb );echo '</pre>'; die();
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.