克隆现有工作表并在其中添加信息

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.

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);