我使用 Laravel Excel,我想单独加载列,如下所示:
$rows = Excel::selectSheetsByIndex(0)->load($fileName);
$a = $rows->select($column1)->get();
$b = $rows->select($column2)->get();
其中 $column1 和 column2 是包含我想要获取的列名的数组。
在我的 $ai 中有 column1,但在我的 $b 中有 column1 和 column2。如何在不重新加载 Excel 文件的情况下将 column2 放在 $b 中?
编辑:解决方案是替换:
$a = $rows->select($column1)->get();
经过 :
$a = $rows->get($column1);