Clone Worksheet throwing unusual error

Topics: Developer Forum, Project Management Forum, User Forum
Jul 4, 2013 at 4:30 PM
I am trying to clone a worksheet and am getting a fatal error.

__Fatal error: clone method called on non-object in C:\wamp\www\sites\techwaterlabs\application\controllers\admin\reports.php on line 119

Here is my code:
$gwreader = new PHPExcel_Reader_Excel5();
$gwswPHPExcel = $gwreader->load(APPPATH."files/gwsw.xls");

$clone = clone $gwswPHPExcel->getSheetByName('0');
$gwswPHPExcel->addSheet($clone, $title);
The file reader works just fine. When I var_dump $gwswPHPExcel it is perfect. The clone is the only thing breaking.

I also use the clone in this same function and works fine. No differences in the code.
Jul 4, 2013 at 4:48 PM
The name of the sheet is actually '0'?
It seems to me reading something about the names of worksheets only in numbers...
Can you use the index (by getSheet())?
Jul 4, 2013 at 5:01 PM
Got it. Stupid mistake. The sheet name was '1' not '0'
Jul 4, 2013 at 5:14 PM
Edited Jul 4, 2013 at 5:15 PM
Work Item #19803 has been fixed in the develop branch on github: you may want to pull that if you are using clone, which affects cloning; but this message suggests there is no worksheet with the name '0'