I have this code and what it does is that it keeps information inside an excel, in this case "Hello World!" , but what happens is that the excel has to be closed so that such execution can be made and when I try to do it with the open excl it sends me an error. Could you load information with an open excel?
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
set_include_path(get_include_path() . PATH_SEPARATOR . 'lib/PHPExcel/');
require_once 'lib/PHPExcel/PHPExcel/IOFactory.php';
require_once 'lib/PHPExcel/PHPExcel.php';
$fileType = 'Excel2007';
$fileName = 'prueba/consulta.xlsx';
// Read the file
$objReader = PHPExcel_IOFactory::createReader($fileType);
$objPHPExcel = $objReader->load($fileName);
// Change the file
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'Hola')
->setCellValue('B1', 'Mundo!');
// Write the file
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $fileType);
$objWriter->save($fileName);
?>