【发布时间】:2021-12-12 17:48:59
【问题描述】:
我有一个包含多张工作表的 Excel,但我只想阅读一张工作表:
我的问题是我有多张纸,它们没有相同的顺序或相同的页数。然后,我必须在我的导入类 (laravel import) 上按名称识别工作表。
这是我的导入类:
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\WithEvents;
class ExecutedUPS implements WithMultipleSheets, WithEvents
{
private $nameSheetUPS = "LMS - F";
public function sheets(): array
{
$sheets = [];
//doesn't work for me
if($event->getSheet()->getTitle() === $this->nameSheetUPS){
$sheets[] = new SheetUPS();
}
return $sheets;
}
}
这是我的课“SheetUPS”:
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
class SheetUPS implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
//this i know do
}
}
【问题讨论】:
标签: excel laravel file-upload import laravel-excel