sh0wtym3 Posted March 14, 2010 Share Posted March 14, 2010 Hey all, I found the following code online which allows you to create and export an excel sheet using PHP: <?php $filename ="excelreport.xls"; $contents = "testdata1 \t testdata2 \t testdata3 \t \n"; header('Content-type: application/ms-excel'); header('Content-Disposition: attachment; filename='.$filename); echo $contents; ?> It works, however, there are certain problems that occur when I try to copy the cells from that php-generated excel sheet, to an excel sheet I have on my PC. I have to copy the content in the cells to notepad, and then to an excel sheet on my pc for it to copy correctly. I think this has to do with encoding the character set for the php generated excel sheet, but I'm not sure what to set it to or how to accomplish that - does anyone know how? Link to comment https://forums.phpfreaks.com/topic/195162-using-php-to-export-excel-sheet/ Share on other sites More sharing options...
trq Posted March 14, 2010 Share Posted March 14, 2010 You will likely have more success using a decent library such as http://phpexcel.codeplex.com Link to comment https://forums.phpfreaks.com/topic/195162-using-php-to-export-excel-sheet/#findComment-1025825 Share on other sites More sharing options...
sh0wtym3 Posted March 14, 2010 Author Share Posted March 14, 2010 Thanks Thorpe, that seems to be exactly what I need Link to comment https://forums.phpfreaks.com/topic/195162-using-php-to-export-excel-sheet/#findComment-1025986 Share on other sites More sharing options...
phpnewbie2010 Posted March 18, 2010 Share Posted March 18, 2010 Thanks a ton thorpe, http://phpexcel.codeplex.com did work fine You will likely have more success using a decent library such as http://phpexcel.codeplex.com Link to comment https://forums.phpfreaks.com/topic/195162-using-php-to-export-excel-sheet/#findComment-1027932 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.