0

我使用Laravel Excel,并且在“A3”单元格中有数据。如何得到它?我认为此代码不起作用。它显示了该表中的所有数据。 参考

 $sheet = $doc->getSheetByName('data'); 
 $sheet->getCell('A3');
4

1 回答 1

1

我也在用。你可以通过dd检查数组,得到需要的单元格。

        public function loadExcel(Request $request)
        {
            $path = $request->file('file')->getRealPath();

            $records = \Excel::load($path, function ($reader) {
                  $reader->noHeading();
            })->get()[0]->toArray();

            dd($records);

          //When you find the index of needed cell just $needed_cell = $records['index'];
    }
于 2017-07-05T16:33:10.527 回答