I have used the phpspredsheet to generate the Excel file. but all works perfect but i want to browser donwload so i have set following code but the file generate the encode with buggy characters.
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Cache-Control: max-age=0');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save('php://output');
output:: like �QĿi!��K�y3�J<���Z1�0?Y�L%zV