In my php page i have a table and if the user requires he has to export that table to excel sheet..
The code for displaying the table is:
$sql=mysql
If all you want is a simple excel worksheet try this:
header('Content-type: application/excel');
$filename = 'filename.xls';
header('Content-Disposition: attachment; filename='.$filename);
$data = '
Cell 1 Cell 2
';
echo $data;
The key here is the xml data. This will keep excel from complaining about the file.