Writing to Worksheets with existing Data

Jan 12, 2015 at 12:53 PM
Hi, so I need to read and write in an existing excel file that has 6 sheets already, but I keep getting this error.

"Call to undefined method PHPExcel", I really don't know what's wrong with it, hope I can get some help with it.
Thanks


here is my code
require_once'PHPExcel.php';
include 'PHPExcel/IOFactory.php';


$inputFileType = 'Excel2007';
$inputFileName = 'Create_Sheet.xlsx';
$sheetname = 'Cantidad de Equipos';


$objReader = PHPExcel_IOFactory::createReader('Excel2007'); 
$objReader->setReadDataOnly(true); 
$objWorkBook = $objReader->load($inputFileName); 
$objWorksheet = $objWorkBook->getActiveSheet(0);
 

$objWorkBook->getActiveSheet()->setCellValue('A1', 'Informe de Inventario ');       
        $objWorkBook->getStyle('A1')->getFont()->setBold(false)->setSize(18);   
    
        $objWorkBook->getColumnDimension('A')->setAutoSize(true);
        $objWorkBook->getDefaultRowDimension()->setRowHeight(-1);

        //$sheet ->setCellValue('A2', ''.$name);
        $objWorkBook->setCellValue('A2', 'Cantidad de Equipos');
        $objWorkBook->getStyle('A2')->getFont()->setBold(false)->setSize(11);

$objWorkBook->fromArray($array, null, 'A4')
    ->getColumnDimension('A')->setAutoSize(true)
    ->getColumnDimension('B')->setAutoSize(true)
    ->getColumnDimension('C')->setAutoSize(true);

$writer = PHPExcel_IOFactory::createWriter($objWorkBook, 'Excel2007');
$writer->save('Create_Sheet.xlsx');