Jump to content

[SOLVED] Populate excel sheet from MySql


Recommended Posts

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

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');

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.

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.