Excel Export
How do I export excel without a heading?
How do I apply the before and after events to an Excel export?
kindly help for this .
Thanks ,
3 Replies
Please suggest how to export excel without heading .
<?php
namespace App\Filament\Exports;
use App\Models\CouponCode;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class CouponCodeExporter extends Exporter
{
protected static ?string $model = CouponCode::class;
public static function getColumns(): array
{
return [
ExportColumn::make('code'),
];
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your coupon code export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}
return $body;
}
}
I’d love to know how to apply an event afterwards. Eg mark the row as exported in the database is something I’d like. Following this one. Hopefully someone can help you out.