esta bien, solo necesitas agregar el cabezal de ese tipo de archivo (excel)
intenta alguno de estos 2
Código PHP:
Ver originalheader('Content-type: application/vnd.ms-excel'); header("Content-Disposition: attachment; filename=archivo.xls");
Código PHP:
Ver originalheader('Content-type: application/ms-excel'); header("Content-Disposition: attachment; filename=archivo.xls");
eso debes ponerlo al inicio del código y no debes imprimir texto.