sseeley Posted August 2, 2009 Share Posted August 2, 2009 Can anyone help me with a really, really basic guide to creating an Excel file through PHP. I want to get the data from mySQL server and then publish this into a downloadble Excel sheet. Many thanks in advance. Stuart Quote Link to comment https://forums.phpfreaks.com/topic/168507-solved-create-excel-file/ Share on other sites More sharing options...
_DarkLink_ Posted August 2, 2009 Share Posted August 2, 2009 Getting data from an SQL table is fairly easy,but you must first tell me how is yuor SQL table is arranged. For the excel sheet, it is not that easy, the only current PHP excel sheet writer and reader that I know of and that I have not tested yet is at: http://pear.php.net/package/Spreadsheet_Excel_Writer I recommend downloading it and try to make it to your desires. Quote Link to comment https://forums.phpfreaks.com/topic/168507-solved-create-excel-file/#findComment-888917 Share on other sites More sharing options...
PFMaBiSmAd Posted August 2, 2009 Share Posted August 2, 2009 You don't need to create an actual .xls file in order to have a "downloadble Excel sheet." If you output the correct Content-Type: header followed by tabular data, excel can probably handle it - http://www.the-art-of-web.com/php/dataexport/ Do you have an example of what you are trying publish? Quote Link to comment https://forums.phpfreaks.com/topic/168507-solved-create-excel-file/#findComment-888921 Share on other sites More sharing options...
ldougherty Posted August 2, 2009 Share Posted August 2, 2009 There is a good working tutorial of creating an excel spreadsheet with PHP at the following URL: http://www.999tutorials.com/php/create-excel-files-with-php/ Quote Link to comment https://forums.phpfreaks.com/topic/168507-solved-create-excel-file/#findComment-888925 Share on other sites More sharing options...
roopurt18 Posted August 2, 2009 Share Posted August 2, 2009 You don't need to create an actual .xls file in order to have a "downloadble Excel sheet." If you output the correct Content-Type: header followed by tabular data, excel can probably handle it - http://www.the-art-of-web.com/php/dataexport/ Do you have an example of what you are trying publish? The latest version of Excel will warn users before opening the file though. Fine for a free site maybe, but not in a business environment. I've used each of the following to create Excel files and they work great: http://pear.php.net/package/Spreadsheet_Excel_Writer http://www.codeplex.com/PHPExcel Quote Link to comment https://forums.phpfreaks.com/topic/168507-solved-create-excel-file/#findComment-888978 Share on other sites More sharing options...
Mark Baker Posted August 2, 2009 Share Posted August 2, 2009 I'd recommend PHPExcel (thanks roopurt18) if you want to create a real Excel file rather than a CSV file. A real Excel file has a number of benefits, including formatting cells and values, and the inclusion of images, which you can't do with a CSV file. Despite the complexities of the Excel file format, using any of the libraries mentioned in this thread makes it very easy to write Excel files from within PHP, because they hide all the complexities; and most are well documented Quote Link to comment https://forums.phpfreaks.com/topic/168507-solved-create-excel-file/#findComment-889007 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.