Reputation: 67
Excel::load($file->getRealPath())->get();
This returns only items, not header.
Upvotes: 1
Views: 2639
Reputation: 1012
use Maatwebsite\Excel\Concerns\WithProperties;
class InvoicesExport implements WithProperties
{
public function properties(): array
{
return [
'creator' => 'Patrick Brouwers',
'lastModifiedBy' => 'Patrick Brouwers',
'title' => 'Invoices Export',
'description' => 'Latest Invoices',
'subject' => 'Invoices',
'keywords' => 'invoices,export,spreadsheet',
'category' => 'Invoices',
'manager' => 'Patrick Brouwers',
'company' => 'Maatwebsite',
];
}
}
try this
Upvotes: 0
Reputation: 40909
You can get file title with:
$file = Excel::load($file->getRealPath())
$file->getTitle();
You can also call getTitle() on individual sheets:
foreach ($file->get() as $sheet) {
echo $sheet->getTitle();
}
Upvotes: 1