Laravel-excel: Set dynamic Delimiter on Export

Created on 20 Jul 2015  路  6Comments  路  Source: Maatwebsite/Laravel-Excel

I found out that there is a setDelimiter method for import but not export. I am looking for the possibility to pass the delimiter that I want to use just in case I need to export a TSV file instead of csv. Thanks

Most helpful comment

The only thing you can do is to overrule the config on the fly: (or just modify the config itself)

Config::set('excel.csv.delimiter', ';');

All 6 comments

The only thing you can do is to overrule the config on the fly: (or just modify the config itself)

Config::set('excel.csv.delimiter', ';');

I am wondering whether the config value will be overriding each other for an application with multiple users if I were to use the suggestion provided above. Thanks

If you use the Config::set right before the export script nothing can go wrong. Then it will only be used for that specific export script.

Ok cool. Thanks for the support :)

It wouldn't work in queued jobs.

if you set a configuration variable inside a job that creates the export, next job will remain the config option.

Config::set("excel.exports.csv.delimiter",';')
Config::set("excel.imports.csv.delimiter",';')

Was this page helpful?
0 / 5 - 0 ratings