Laravel-excel: Downloading a collection as Excel

Created on 11 Apr 2018  路  4Comments  路  Source: Maatwebsite/Laravel-Excel

Hello, my question is just basic, but because I couldn't find the answer anywhere, so please help me!
I tried to use this one:

(new Collection([[1, 2, 3], [1, 2, 3]]))->downloadExcel(
$filePath,
$writerType = null,
$headings = false
)

I don't know what correct form should $writeType be. I tried Excel::XLSX but got the error:
"Undefined class constant 'XLSX'".

Hope you don't mind such a basic question, and thank you very much!

more information needed

Most helpful comment

@courtney1403 you can let the package guess the correct writer type. Just have .xlsx as your file extension in the filePath.

Excel::XLSX is \Maatwebsite\Excel\Excel::XLSX

All 4 comments

Thanks for submitting the ticket. Unfortunately the information you provided is incomplete. Before we can pick it up, please check (https://github.com/Maatwebsite/Laravel-Excel/blob/3.0/.github/ISSUE_TEMPLATE.md) and add the missing information. To make processing of this ticket a lot easier, please make sure to check (https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/contributing) and double-check if you have filled in the issue template correctly. This will allow us to pick up your ticket more efficiently. Issues that follow the guidelines correctly will get priority over other issues.

@courtney1403 you can let the package guess the correct writer type. Just have .xlsx as your file extension in the filePath.

Excel::XLSX is \Maatwebsite\Excel\Excel::XLSX

Thank you so much, patrickbrouwers.

Yw!

Was this page helpful?
0 / 5 - 0 ratings