Problems with appending using fromArray

Topics: Developer Forum
Sep 7, 2015 at 1:08 PM
I'm trying to append rows to an existing spreadsheet. I can open the existing sheet and find its dimensions - and therefore the last row - using this:
$findDimensions = $objPHPExcel2->getActiveSheet()->calculateWorksheetDimension();

I have the new data in a two-dimensional PHP array $newData, but when I try to append using:

$objPHPExcel2->getActiveSheet->fromArray($newData, null, 'A'.$appendStartRow);

...where $appendStartRow is 2 or greater, I get this:

Notice: Undefined property: PHPExcel::$getActiveSheet in C:\PHP\test.php on line 200

Fatal error: Call to a member function fromArray() on null in C:\PHP\test.php on line 200

I don't understand the cause of the error.

PHP Version: 5.6.12
PHPExcel: 1.8
Windows 7 64-bit

Chris.
Coordinator
Sep 7, 2015 at 1:55 PM
getActiveSheet() is a method, not a property.
$objPHPExcel2->getActiveSheet()->fromArray($newData, null, 'A'.$appendStartRow); 
Marked as answer by ChrisValentine on 9/8/2015 at 1:12 AM