© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
keithjk

Excel Export with Date Column

Hello, I am trying to use the Actions to export data to Excel (CSV). The function works great except when including a DateTime column. When I include any DateTime column in the export, it returns a blank export. I've also tried to use the formatStateUsing() function to ensure it's converting to a string, with no luck. I've looked through the docs and don't see any information specific to Date or DateTime fields when exporting to Excel.

Has anyone else run into this issue and know how to solve? Or is this a known field type that can't be exported and I'm just not seeing that?

class MailchimpExport extends Exporter
{
    protected static ?string $model = EventAttendance::class;

    /**
     * Export columns.
     */
    public static function getColumns(): array
    {
        return [
            ExportColumn::make('attendee_email')
                ->label('Email Address'),
            ExportColumn::make('attendee_name_first')
                ->label('First Name'),
            ExportColumn::make('attendee_name_last')
                ->label('Last Name'),
            ExportColumn::make('attendee_company')
                ->label('Company'),
            ExportColumn::make('attendee_title')
                ->label('Title'),
            ExportColumn::make('get_profession.title')
                ->label('Profession'),
            ExportColumn::make('pronouns')
                ->label('What are your pronouns?'),
            ExportColumn::make('event.chapters')
                ->label('What groups are you interested in hearing about?')
                ->formatStateUsing(function ($state): ?string {
                    return implode('; ', $state->pluck('title')->toArray());
                }),
            ExportColumn::make('eventbrite_order_timestamp')
                ->label('Test')
                ->formatStateUsing(function ($state): ?string {
                    return $state->toISOString();
                }),
        ];
    }
class MailchimpExport extends Exporter
{
    protected static ?string $model = EventAttendance::class;

    /**
     * Export columns.
     */
    public static function getColumns(): array
    {
        return [
            ExportColumn::make('attendee_email')
                ->label('Email Address'),
            ExportColumn::make('attendee_name_first')
                ->label('First Name'),
            ExportColumn::make('attendee_name_last')
                ->label('Last Name'),
            ExportColumn::make('attendee_company')
                ->label('Company'),
            ExportColumn::make('attendee_title')
                ->label('Title'),
            ExportColumn::make('get_profession.title')
                ->label('Profession'),
            ExportColumn::make('pronouns')
                ->label('What are your pronouns?'),
            ExportColumn::make('event.chapters')
                ->label('What groups are you interested in hearing about?')
                ->formatStateUsing(function ($state): ?string {
                    return implode('; ', $state->pluck('title')->toArray());
                }),
            ExportColumn::make('eventbrite_order_timestamp')
                ->label('Test')
                ->formatStateUsing(function ($state): ?string {
                    return $state->toISOString();
                }),
        ];
    }
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Excel export autofit column width
FilamentFFilament / ❓┊help
2y ago
Filament Excel Export Column Group
FilamentFFilament / ❓┊help
3y ago
excel export
FilamentFFilament / ❓┊help
2y ago
export excel
FilamentFFilament / ❓┊help
2y ago