Reputation: 6928
I have 2 sheets in my .xlsx
file. i need to open sheet number 1
and clone it with data as i do foreach
loop.
Message: Workbook already contains a worksheet named 'otchet-shablon'. Rename this worksheet first.
Upvotes: 0
Views: 87
Reputation: 212412
Rename the cloned worksheet (which will still have the same name as the original because it is a clone) before adding it to the PHPExcel object
$activeSheet = $objPHPExcel->getActiveSheet();
$activeSheet1 = clone $activeSheet;
$activeSheet1->setTitle('New worksheet title')
$objPHPExcel->addSheet($activeSheet1);
Upvotes: 1