4

我已经用Laravel Excel.xls加载了文件:

Excel::load('public/files/20160621.xls', function($reader) {
    // read a cell value
});

如何读取加载的 excel 文件的单元格值?这部分的文档似乎不清楚。

4

3 回答 3

8
public function get()
{
    $excelFile ...
    return Excel::load($excelFile, function($doc) {

        $sheet = $doc->getSheetByName('data'); // sheet with name data, but you can also use sheet indexes.

        $sheet->getCell('A1');
        $sheet->getCellByColumnAndRow(0,0);           

    });
}

没错,阅读某些单元格的文档尚不清楚。希望这会帮助你。

于 2016-06-28T11:32:04.993 回答
0

尝试这个

$sheet->getCell('A1')->setCell($sheet->getCell('B1')->getValue);

您可以在这里找到更多信息

于 2017-06-18T06:00:50.887 回答
0

供阅读使用

public function reader($file)
{
    $excel=Excel::load($file, function($reader) {
        $reader->...//Document propities

        $sheet = $doc->getSheet(0); // sheet with index

        $cell=$sheet->getCell('A1')->getValue();       

    })->toArray()//get();
   ...
   $cell=$excel->index//[row][col] Get formatted type(date,currency,calculated) cells
  ...
}
于 2017-12-18T15:45:13.433 回答