Export from PHP to EXCEL

You can set above your PHP script the following line of code:

<?
$filename=$_GET['filename']. ".xls";
header ( "Content-Type: application/vnd.ms-excel");
header ( "Content-Disposition: inline; filename=$filename");
?>

So you can pass the filename like this:

http://www.yoursite.com/export-excel.php?filename=export_xls

If you need more advanced functions for manage your xls file with php you can use the following pear package:
http://pear.php.net/package/Spreadsheet_Excel_Writer

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: