I am trying to export an export file in PHP. I am using Codeigniter Framework.
I exported Excel in this way:
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename={$filename}.xls");
It is showing data in Windows in right format. But prompt a message when I initially open it. But When I open it in MAC OS, it is not working.
How can I export Excel in right format that works in Google Drive as well? I have tried so many ways as above and as follows. All not working properly in Mac and Google Drive spreadsheets:
header('Content-Disposition: attachment; filename='.$filename.'.xlsx');
header('Content-type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment; filename='.$filename.'.xls');
header('Content-type: application/vnd.ms-excel');
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=$filename.xls");