Maatwebsite, export to XLSX giving currepted data in Laravel

62 views Asked by At

I am using below code to Export into .xlsx using package maatwebsite/excel

$fileName = 'Stats-GroupID_' . $groupId . '-' . time() . '.xlsx';

return Excel::download($statsExport->setGroupId($groupId), $fileName);

The output is filled with broken characters: � as shown in the screenshot.

screenshot

I tried ob_end_clean(); It was working, but I'm not sure whether it will break anything across my projects, so don't want to use it.

1

There are 1 answers

0
NIKHIL NEDIYODATH On

Try calling ob_start method after ob_end_clean as follows

ob_end_clean();
ob_start();