kickoutbettman Posted May 5, 2009 Share Posted May 5, 2009 Hello all ! Here's the situation. I have a golf stat web site. I have a lot of golf courses with some information (yardage, pars, etc etc) into MySql DB. I also have a "generic" excel sheet already formated to look like a golf score card. I want my users to be able to select 1 course from my DB FROM A WEB LINK and once they select the course it will open my "generic" excel sheet and populate the course information into it. I have no idea where to start. I think I might need to use ODBC connection, but how do I set this up on a web server (which is not mine). Thank you Link to comment https://forums.phpfreaks.com/topic/156943-solved-populate-excel-sheet-from-mysql/ Share on other sites More sharing options...
Mark Baker Posted May 5, 2009 Share Posted May 5, 2009 Use a library like PHPExcel (see signature) Link to comment https://forums.phpfreaks.com/topic/156943-solved-populate-excel-sheet-from-mysql/#findComment-826682 Share on other sites More sharing options...
kickoutbettman Posted May 5, 2009 Author Share Posted May 5, 2009 Thanks for the reply, Would there be something a bit less complicated. I tried to read some doc and honestly I'm completely lost. Link to comment https://forums.phpfreaks.com/topic/156943-solved-populate-excel-sheet-from-mysql/#findComment-826837 Share on other sites More sharing options...
Mark Baker Posted May 6, 2009 Share Posted May 6, 2009 Would there be something a bit less complicated. I'm not sure it's possible to make it much easier. Try looking at some of the examples in the Tests directory // Include the library include 'PHPExcel/IOFactory.php'; // Read the template $objPHPExcel = PHPExcel_IOFactory::load("template.xls"); // Write your data into the worksheet $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', 0); $objPHPExcel->getActiveSheet()->setCellValue('A2', 1); $objPHPExcel->getActiveSheet()->setCellValue('A3', 1); $objPHPExcel->getActiveSheet()->setCellValue('A4', 2); $objPHPExcel->getActiveSheet()->setCellValue('A5', 3); $objPHPExcel->getActiveSheet()->setCellValue('A6', 5); $objPHPExcel->getActiveSheet()->setCellValue('A7', ; $objPHPExcel->getActiveSheet()->setCellValue('A8', 13); // Save as a new Excel file $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('ExcelFile.xlsx'); Link to comment https://forums.phpfreaks.com/topic/156943-solved-populate-excel-sheet-from-mysql/#findComment-827333 Share on other sites More sharing options...
kickoutbettman Posted May 6, 2009 Author Share Posted May 6, 2009 Here's the easiest way I found. It is actually very simple... http://www.tecnorama.org/document.php?id_doc=64 Basicaly, you need to put a header into your php file and then recreate the info you want to have in your excel sheet. Run the file and it opens right away. Thank you all for you help. Link to comment https://forums.phpfreaks.com/topic/156943-solved-populate-excel-sheet-from-mysql/#findComment-827421 Share on other sites More sharing options...
Mark Baker Posted May 6, 2009 Share Posted May 6, 2009 Basicaly, you need to put a header into your php file and then recreate the info you want to have in your excel sheet. So you're not really using an Excel worksheet, just creating something that can be opened in Excel. So what happened to your "generic" excel sheet already formated to look like a golf score card? The Excel worksheet that you needed to update, or is that HTML as well? Link to comment https://forums.phpfreaks.com/topic/156943-solved-populate-excel-sheet-from-mysql/#findComment-827540 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.