[英]Laravel Excel - Only returns first column of row
我正在嘗試通過Laravel Excel( http://www.maatwebsite.nl/laravel-excel/docs )導入Excel數據。 我正在使用Laravel 4.2。
但是我只得到結果行的第一列,這對我來說似乎很奇怪,而且我知道原因。
Excel::selectSheetsByIndex(0)->load("fileName.xlsx", function($reader) {
$reader->skip(14);
dd($reader->first());
});
我得到這個結果:
object(Maatwebsite\Excel\Collections\CellCollection)#19057 (2) {
["title":protected]=> NULL ["items":protected]=> array(2) {
["flik_1_personal"]=> string(7) "Annika " [0]=> NULL
}
}
我希望得到所有細胞,但事實並非如此。 有人知道為什么會這樣嗎? 謝謝!
更新看起來是因為我沒有其他單元格的“標頭”(名字除外,結果中顯示了名字)。 是否有一個獲取單元格值的設置,而沒有“標題”?
嘗試這個
Excel::selectSheetsByIndex(0)->load($file, function($reader) {
foreach ($reader->toArray() as $row) {
$bb[] = $row;
}
echo '<pre>';print_r($bb );echo '</pre>'; die();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.