Level 63
You can do what you need by adding a mapping function in the RoExport class.
https://docs.laravel-excel.com/3.0/exports/column-formatting.html
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello.
First I'm using maatwebsite/excel version 3.1.
Laravel 8.
I'm wondering if it's possible to set the column type to date when I export.
return Excel::download(
new RoExport(
collect($resultArray)
->sortBy(
['employee_fullname']
)->toArray(),
$request->exportType),
'file_name.xls');
Here the dd($resultArray) result :
array:49 [▼
0 => {#1685 ▼
+"employee_fullname": "aaa bbbb"
+"user_id": 1161
+"plannings_to_month": "December 2022"
+"project": "Excellence en fiabilité"
+"is_funded": "Is not funded"
+"total_working_days": "22.00000000000000000000"
+"possible_working_days": 22
+"percentage": 100.0
My question is : plannings_to_month attribute is the date value but I'm wondering I should change it in the controller or if there is a way in maatwebsite/excel to set the column type ?
Thanks
Please or to participate in this conversation.