Issue: Cant get Calculated Value from a cell refferencing different sheet.

Topics: Developer Forum
Dec 1, 2014 at 4:50 PM
Edited Dec 1, 2014 at 5:04 PM
Hey, I'm trying for a few hours now and can't get this to work.
My excel file ( ) has 3 sheets and I need to gather data from 2nd sheet (vollmer). Most of the cells are calculated from the 1st sheet (daten), but I cant get the calculated value of those cells.

Phpinfo is accessible on the link I provided above (full phpinfo).
PHPExcel version: 1.8.0, 2014-03-02

Below the php info are my outputs.

1st output is with getValue() and gives literal cell value, it works like it should.
After it there should be a 2nd output with the calculated value. The calculated value gives me an error.
Fatal error: Uncaught exception 'PHPExcel_Calculation_Exception' with message 'vollmer!M1 -> Column string index can not be empty' in /home/acfanaly/public_html/webmistik/ Stack trace: #0 /home/acfanaly/public_html/webmistik/ PHPExcel_Cell->getCalculatedValue() #1 {main} thrown in /home/acfanaly/public_html/webmistik/ on line 300
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

echo "PHP INFO<br>";

echo "START PHPEXCEL<br>";
$inputFileName = "phpexcel1.xlsx";

/** Include PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/PHPExcel/Classes/PHPExcel/IOFactory.php';

$inputFileType = PHPExcel_IOFactory::identify($inputFileName);

$objReader = PHPExcel_IOFactory::createReader($inputFileType);

$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);


$objWorksheet = $objPHPExcel->getActiveSheet();

$homeName = $objPHPExcel->getActiveSheet(0)->getCellByColumnAndRow(4, 17)->getValue();

$awayName = $objPHPExcel->getActiveSheet(0)->getCellByColumnAndRow(19, 17)->getValue();

echo "Output: $homeName - $awayName<br>";

$homeName = $objPHPExcel->getActiveSheet(0)->getCellByColumnAndRow(4, 17)->getCalculatedValue();

$awayName = $objPHPExcel->getActiveSheet(0)->getCellByColumnAndRow(19, 17)->getCalculatedValue();

echo "Output: $homeName - $awayName<br>";


If anyone could get this to work, I'd be very grateful. Thanks!