Я думаю $event->getSheet()->getTitle()
должно работать. Вы также можете использовать события.
class HImport1 implements ToCollection, WithHeadingRow, WithEvents
{
public $sheetNames;
public $sheetData;
public function __construct(){
$this->sheetNames = [];
$this->sheetData = [];
}
public function collection(Collection $collection)
{
$this->sheetData[] = $collection;
}
public function registerEvents(): array
{
return [
BeforeSheet::class => function(BeforeSheet $event) {
$this->sheetNames[] = $event->getSheet()->getTitle();
}
];
}
}