Custom Filament Page to Download Excel Report

Filament can export records from tables by default. But if you want to have settings, you must use a Custom Page.

FilamentExamples ThumbBase - 2025-01-07T144958.151

Get the Source Code:

How it works

We have a custom Filament page with a form to select a date and a customer.

app/Filament/Pages/Download.php:

use Filament\Pages\Page;
use Filament\Forms\Form;
use App\Models\Customer;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\DatePicker;
 
class Download extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';
 
protected static string $view = 'filament.pages.download';
 
public ?array $data = [];
 
public function mount(): void
{
$this->form->fill();
}
 
public function form(Form $form): Form
{
return $form
->schema([
DatePicker::make('trade_date')
->minDate(now()->subMonths(2)->startOfMonth())
->maxDate(today()),
Select::make('customer')
->required()
->options(Customer::pluck('name', 'id')),
])
->statePath('data');
}
}

Next, we will work on:

  • Custom page View
  • Installing Laravel Excel package
  • Adding the Export logic
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 68 Premium Examples for $99