I am trying to generate an excel file with the extension .xlsx from the code below. I am able to download the file very well but when I open it with excel sheet, I receive t
Change
ob_end_clean();
with this
if (ob_get_contents()) ob_end_clean();