PHP excel export without saving a file
-
First define a filename, and headers.
$filename = "test.xls";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: application/vnd.ms-excel");
Now just send the clear text data you want the excel file to contain, use “\n” and “\t” for row and column navigation.
For example:
echo "column1 \t column2\n";
echo "row1 value1" . "\t" . "row1 value2\n";
echo "row2 value1" . "\t" . "row2 value2";
exit(); //remember to stop output unless you do it its own file.
Click the excel icon below to see how the export of this data would look like.
Leave a Reply
Welcome to Thronic.com
Search this Site
Miscellaneous Links
Recent Articles
- Google-like search suggestion tool
- Linux Bash Color
- Resize a div layer with javascript
- Moving a div layer with javascript
- Web Galaxy » A sci-fi browser game
- Windows 7 on Asus Eee 900 PC
- IE and PHP sessions
- Wordpress 2.8.6 Spell Check Languages
- Reset MySQL Root Password
- Linux hosts file
- IdleGuard
- Column count in SQL
- String encryption in PHP
- Alphanumeric Captcha values in PHP
- Your own numeric Captcha in PHP
