merge multiple worksheets into 1 worksheet

Topics: Developer Forum, User Forum
Oct 5, 2013 at 8:24 AM
I want to merge worksheets from multiple excel sheets into 1 worksheet in a new excel file.

I referred to the discussion

I did not understand what MarkBaker meant by using toArray(). I mean how do I use it.
My Current Code is:
$objPHPExcel1 = PHPExcel_IOFactory::load($file1);
$outputFile = "output.xlsx";

$objPHPExcel2 = PHPExcel_IOFactory::load($file2);
$sheet = $objPHPExcel2->getActiveSheet();

$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel1); 
With this I am able to get different worksheets of various files into a new workbook but as different sheets.

What should I do to get it all onto the same sheet like vitman said?
--empty line--
--empty line--