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

# XLSX

return (new InvoicesExport)->download('invoices.xlsx', \Maatwebsite\Excel\Excel::XLSX);
1

# CSV

return (new InvoicesExport)->download('invoices.csv', \Maatwebsite\Excel\Excel::CSV);
1

By default the CSV is download with Content Type text/plain, if you want to customize the Content-Type header, you can do so by passing it as 3rd parameter.

return (new InvoicesExport)->download('invoices.csv', \Maatwebsite\Excel\Excel::CSV, [
      'Content-Type' => 'text/csv',
]);
1
2
3

Laravel CSV

You may have a look at our Laravel CSV package as well.

# TSV

return (new InvoicesExport)->download('invoices.tsv', \Maatwebsite\Excel\Excel::TSV);
1

# ODS

return (new InvoicesExport)->download('invoices.ods', \Maatwebsite\Excel\Excel::ODS);
1

# XLS

return (new InvoicesExport)->download('invoices.xls', \Maatwebsite\Excel\Excel::XLS);
1

# HTML

return (new InvoicesExport)->download('invoices.html', \Maatwebsite\Excel\Excel::HTML);
1

Exporting to PDF

If you'd like to export to PDF, you must now install a PDF rendering library yourself. Please refer to the PhpSpreadsheet Documentation for more information.

# MPDF

return (new InvoicesExport)->download('invoices.pdf', \Maatwebsite\Excel\Excel::MPDF);
1

# DOMPDF

return (new InvoicesExport)->download('invoices.pdf', \Maatwebsite\Excel\Excel::DOMPDF);
1

# TCPDF

return (new InvoicesExport)->download('invoices.pdf', \Maatwebsite\Excel\Excel::TCPDF);
1