Export formats

By default, the export format is determined by the extension of the file. If you want to explicitly configure the export format, you can pass it through as 2nd parameter.

You can customize the download headers with the optional 3rd parameter $headers. This way, you can customize the mime type for example.

XLSX

(new InvoicesExport)->download('invoices.xlsx', \Nikazooz\Simplesheet\Simplesheet::XLSX);
1

CSV

// mime type is guessed and results to text/plain
(new InvoicesExport)->download('invoices.csv', \Nikazooz\Simplesheet\Simplesheet::CSV);

// custom mime type text/csv
(new InvoicesExport)->download(
    'invoices.csv',
    \Nikazooz\Simplesheet\Simplesheet::CSV,
    [
        'Content-Type' => 'text/csv',
    ]
);
1
2
3
4
5
6
7
8
9
10
11

TSV

(new InvoicesExport)->download('invoices.tsv', \Nikazooz\Simplesheet\Simplesheet::TSV);
1

ODS

(new InvoicesExport)->download('invoices.ods', \Nikazooz\Simplesheet\Simplesheet::ODS);
1