pxlrbt / filament-excel

Excel Export for Filament Admin Resources
MIT License
340 stars 69 forks source link

Custom CSV Settings #71

Open mackhankins opened 1 year ago

mackhankins commented 1 year ago

Would it be possible to support these in a future version?

https://docs.laravel-excel.com/3.1/exports/settings.html#custom-csv-settings

pxlrbt commented 1 year ago

I haven't used CSV export yet, but it should be easy to add.

SDJeff commented 1 year ago

Would be great if that can implemented

pxlrbt commented 1 year ago

Curious on which settings you are interested in? All of them? Do you want to set these per Export? Or why don't you overwrite the config file?

SDJeff commented 1 year ago

Just need a simple TXT File Values TAB separated. For example:

->withCustomCsvSettings(
        [
            'delimiter' => '\t',
            'use_bom' => false,
            'output_encoding' => 'ISO-8859-1',
        ];
)
rasmustaarnby commented 1 year ago

@SDJeff I just ran into the same issue.

I'm using this quick and dirty trick to overwrite the config on the fly.

FilamentExcel\Actions\Tables\ExportBulkAction::make()
    ->before(function () {
        config(
            [
                'excel.exports.csv' => [
                    'delimiter' => '\t',
                    'enclosure' => '',
                ]
            ]
        );
    })

Update: We have one download action that needs a different format than all other CSV downloads, which is why it would be nice to control it per export action.

SDJeff commented 1 year ago

Check! Works like mentioned! Could be a workaround! Thx