filament-excel icon indicating copy to clipboard operation
filament-excel copied to clipboard

Custom CSV Settings

Open mackhankins opened this issue 2 years ago • 6 comments

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

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

mackhankins avatar Apr 18 '23 21:04 mackhankins

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

pxlrbt avatar Apr 20 '23 05:04 pxlrbt

Would be great if that can implemented

SDJeff avatar Aug 25 '23 14:08 SDJeff

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?

pxlrbt avatar Aug 26 '23 08:08 pxlrbt

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

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

SDJeff avatar Aug 27 '23 05:08 SDJeff

@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.

rasmustaarnby avatar Sep 04 '23 08:09 rasmustaarnby

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

SDJeff avatar Sep 12 '23 06:09 SDJeff