Is it not possible to create a function with PHPexcel like this?
$objPHPExcel = new PHPExcel();
global $objPHPExcel;
function Create($title, $index)
{
global $objPHPExcel;
$objPHPExcel->setActiveSheetIndex($index);
$objPHPExcel->getActiveSheet()->setTitle($title);
}
Create('Title1', 0);
Create('Title2', 1);
I get this error: Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'You tried to set a sheet active by the out of bounds index: 1. The actual number of sheets is 1
Createyou pass1as$indexand it seems that you Excel file only has one sheet. - yorodm