Formula Results Not Showing

Oct 29, 2009 at 9:35 PM


I'm using an existing spreadsheet containing formulas, and adding values to the sheet via PHPExcel, but the formulas are not working unless the cells containing the data are "touched" first.

Here is my code:


// standard includes
require_once '../Classes/PHPExcel.php';
require_once '../Classes/PHPExcel/IOFactory.php';

// read in the existing file
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = PHPExcel_IOFactory::load("data.xlsx");

// insert data
$objPHPExcel->setActiveSheetIndex(1)->setCellValue('E8', '20');
$objPHPExcel->getActiveSheet()->setCellValue('F8', '10');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');

The formula is simply adding cells E8 & F8 together. Basically the cells are filled with the correct data from above, but excel will not calculate the result unless you double click on each cell first to sort of "refresh" it. Refreshing the worksheet/workbook does not work. Do you have any ideas?


Thanks again for a fantastic product.


Oct 30, 2009 at 12:30 AM

Are you on Windows 7