I want to export data to excel sheet. I have a workbook x, the workbook is to have several worksheets created by php excel. I would like to export data in the format that if sheet one has data, then php excel needs to create the second sheet by itself and subsequent sheets without me specifying the sheet index $objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("workbooks/" . $labref . "/" . $labref . ".xlsx");
$objPHPExcel->getActiveSheet();
$objWorkSheet = $objPHPExcel->createSheet();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel,'Excel2007');
$objWriter->save("workbooks/" . $labref . "/" . $labref . ".xlsx");
In the above case, when exporting, the workbook is deleted by php excel and so phpexcel can't create and write to the created sheet