Laravel Excel: 如何获取单元格的值?
Laravel Excel: how to get value of a cell?
我已经用 Laravel Excel 加载了 .xls
文件:
Excel::load('public/files/20160621.xls', function($reader) {
// read a cell value
});
如何读取加载的 excel 文件的单元格值?这部分的文档似乎不清楚。
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);
});
}
你说得对,读取某些单元格的文档不清楚。
希望对您有所帮助。
试试这个
$sheet->getCell('A1')->setCell($sheet->getCell('B1')->getValue);
您可以找到更多信息 here
阅读使用这个
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
...
}
我已经用 Laravel Excel 加载了 .xls
文件:
Excel::load('public/files/20160621.xls', function($reader) {
// read a cell value
});
如何读取加载的 excel 文件的单元格值?这部分的文档似乎不清楚。
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);
});
}
你说得对,读取某些单元格的文档不清楚。 希望对您有所帮助。
试试这个
$sheet->getCell('A1')->setCell($sheet->getCell('B1')->getValue);
您可以找到更多信息 here
阅读使用这个
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
...
}