i have grid that gets data from data base like this :-
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="gwlines">
<tbody><tr>
<th width="15">#</th>
<th width="150">Name</th>
<th width="100">Type</th>
<th width="50">Date</th>
<th width="50">From</th>
<th width="50">To</th>
<th width="30">Price</th>
<th width="30">Paid</th>
<th width="30">Remaind</th>
<th colspan="4">Actions</th>
</tr>
<?
$i=1;
while($objResult=mysql_fetch_array($objQuery)){
?>
<tr id="vip_row<?=$objResult["vip_id"];?>" <? echo ($i%2==0?'bgcolor="#edf0f6"':''); ?>>
<td><input name="cbSelect[]" type="checkbox" id="cbSelect[]" value="<?=$objResult["vip_id"]; ?>" /></td>
<td><?=$objResult["customer_name"]; ?></td>
<td><?=$objResult["vip_type"]; ?></td>
<td><?=$objResult["vip_date"]; ?></td>
<td><?=$objResult["vip_from"]; ?></td>
<td><?=$objResult["vip_to"]; ?></td>
<td><?=$objResult["vip_price"]; ?></td>
<td><?=$objResult["vip_paid"]; ?></td>
<td><?=$objResult["vip_remind"]; ?></td>
<td width="16"><a href="index.php?body=edit_vip&id=<?=$objResult["vip_id"];?>" original-title="Edit and View VIP Information"><img width="15" height="15" class="tabpimpa" alt="picture" src="images/edit.png"></a></td>
<td width="16"><a href="#" onClick="delete_vip('<?=$objResult["vip_id"];?>');" original-title="Delete VIP"><img width="15" height="15" class="tabpimpa" alt="picture" src="images/delete.png"></a></td>
<td width="16"><a href="print_single_bills_vip.php?id=<?=$objResult["vip_id"];?>" target="_new"><img width="15" height="15" class="tabpimpa" alt="picture" src="images/print.png"></a></td>
<td width="16"><a href="#" onClick="vip_to_egypt('<?=$objResult["vip_id"];?>');"><img width="15" height="15" class="tabpimpa" alt="picture" src="images/sms.png"></a></td>
</tr>
<? ++$i; } ?>
</tbody></table>
this grid will get data from data base, and i want to export this result data to excel.
how can i do this?
try using phpexcel
happy coding :)
EDIT: "phpexcel" is a project providing a set of classes for the PHP programming language, which allow you to write to and read from different spreadsheet file formats, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's OpenXML standard and PHP.
-by phpexcel site
Following from http://support.microsoft.com/kb/165499 you should be able to just save the HTML table and open it in excel!
It will of course drop most of the formatting and the functions, but most of the time that is not a real concern when exporting data to excel.