1. Go to this page and download the library: Download cube-agency/filament-excel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cube-agency / filament-excel example snippets
use CubeAgency\FilamentExcel\Actions\ExcelExportAction;
use CubeAgency\FilamentExcel\Actions\ExcelExportBulkAction;
use CubeAgency\FilamentExcel\Exports\Columns\Column;
$table
->headerActions([
// Zero config: exports visible columns, respecting filters, search and sort
ExcelExportAction::make(),
// Or configured inline
ExcelExportAction::make('styled')
->columns([
Column::make('name')->width(40),
Column::make('email')->heading('E-mail'),
Column::make('balance')->format('#,##0.00'),
])
->filename('users'),
])
->toolbarActions([
ExcelExportBulkAction::make(), // selected rows only
]);
use CubeAgency\FilamentExcel\Actions\ExcelImportAction;
use CubeAgency\FilamentExcel\Imports\Columns\ImportColumn;
ExcelImportAction::make()
->model(User::class)
->columns([
ImportColumn::make('name')->