Reputation: 2071
I am using PHPExcel for create new sheet for an existing excel file with 3 sheets.
$newWorkSheet = new PHPExcel_Worksheet($objPHPExcel, 'filter');
$this->objPHPExcel->addSheet($newWorkSheet);
After calling $this->objPHPExcel->getSheetCount()
it prints 4.
But when I see the current excel file, there is not any new sheet.
Upvotes: 0
Views: 248
Reputation: 3171
You are forgetting the save part..
example..
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
Further Example in the official docs
http://phpexcel.codeplex.com/wikipage?title=Examples&referringTitle=Home
Upvotes: 1
Reputation: 44834
This is only creating an in-memory instance of the sheet. It will need to be written to disk.
Upvotes: 1