template of a worksheet

Topics: Developer Forum, User Forum
Dec 15, 2010 at 7:11 AM

I have a template of a worksheet in excel file.

Could I use phpexcel to load database and get data put in this template of a worksheet in excel file?

I know how to put data in worksheet. But I don't know how to open the excel file for use the template.

Dec 15, 2010 at 10:55 PM

Just load it like any other workbook, rather than instantiating a new PHPExcel object.

$inputFileType = 'Excel5';
$inputFileName = './myTemplate.xls';
/**  Create a new Reader of the type defined in $inputFileType  **/
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
/**  Load $inputFileName to a PHPExcel Object  **/
$objPHPExcel = $objReader->load($inputFileName);