Not reading the value from Cell

Topics: Developer Forum
Jan 19, 2015 at 3:41 PM
Hi Guys,

I've been pulling my hair out over this for 2 days and hoping somebody can help.

Here is the test URL for the site:

On the filter life calculation tab, this is the 5th one down the table doesn't show the values correctly, but only if the years on the "filter life" tab is set to 3 or 5 all other years work fine, nothing changes in the spreadsheet with these years and if you open the spreadsheet the values are there but PHPExcel doesn't read them for some reason, even more confusing is if I manually type the value in it then reads it fine.

Here is the code for the filter life calculation page:
    if(isset($_GET['sestamp'])) {
        $clientfile = $_GET['sestamp'];
        $path = 'inc/files/'.$clientfile;

    } else {
        $clientfile = $_SESSION['file'];
        $path = 'inc/files/'.$clientfile;


    echo $clientfile;


<?php include('inc/header.php'); ?>

<div class="left-panel">
    <img src="images/side-logo.png" alt="FRAM Industrial" />
    <div class="side-nav">
        <a href="index.php" class="nav-1">Home</a>
        <a href="2-turbine.php" class="nav-2">Turbine</a>
        <a href="3-pair-price.php" class="nav-3">Pair Price</a>
        <a href="4-filter-life.php" class="nav-4">Filter Life</a>
        <a href="5-filter-calculation.php" class="nav-5 active">Filter Calculation</a>
        <a href="6-filter-class.php" class="nav-6">Filter Class</a>
        <a href="7-contamination-calculation.php" class="nav-7">Contamination Calculation</a>
        <a href="8-revenue.php" class="nav-8">Revenue</a>
        <a href="9-notes.php" class="nav-9">Notes</a>
    <div class="side-foot">
        <p class="white"><strong>FRAM Industrial<br />(Europe) Ltd</strong></p>
        <p class="white">Crown Farm Way,<br />
        Mansfield,<br />
        Nottinghamshire,<br />
        NG19 0FT</p>
        <p class="white">01623 412 412<br />
        <a href=""><strong></strong></a></p>

<div class="right-panel">
    <div class="right-cont">
        <div class="right-left">
            <div class="spacer">&nbsp;</div>
                $objReader = PHPExcel_IOFactory::createReader('Excel2007');

                $objPHPExcel = $objReader->load($path);
                $objPHPExcel->setActiveSheetIndexByName("PAIR CALC");
                $objWorksheet = $objPHPExcel->getActiveSheet();

                $filter = $objPHPExcel->getActiveSheet()->getCell('G8')->getCalculatedValue();

                //Test Code


                <table width="450" cellspacing="0">
                    <tr class="table-title">
                        <td width="116" align="center" valign="middle"><strong>Pressure Loss<br />Calculation</strong></td>
                        <td width="142" align="center" valign="middle"><strong>Comparison</strong></td>
                        <td width="142" align="center" valign="middle"><strong><?php echo $filter; ?></strong></td>
                    <tr class="first-row">
                        <td valign="middle" height="20">Efficiency Loss (%)</td>
                        <td align="center" valign="middle" height="30"><?php echo $objPHPExcel->getActiveSheet()->getCell('E26')->getFormattedValue(); ?></td>
                        <td align="center" valign="middle" height="30"><?php echo $objPHPExcel->getActiveSheet()->getCell('G26')->getFormattedValue(); ?></td>
                        <td valign="middle">Lost Energy (mWh)</td>
                        <td align="center" valign="middle" height="30"><?php echo $objPHPExcel->getActiveSheet()->getCell('E27')->getFormattedValue(); ?></td>
                        <td align="center" valign="middle" height="30"><?php echo $objPHPExcel->getActiveSheet()->getCell('G27')->getFormattedValue(); ?></td>
                        <td valign="middle">Lost Revenue (£)</td>
                                $custrev = $objPHPExcel->getActiveSheet()->getCell('E28')->getCalculatedValue();
                                $custrev = number_format ( $custrev, 2, '.', ',' );
                                $filtrev = $objPHPExcel->getActiveSheet()->getCell('G28')->getCalculatedValue();
                                $filtrev = number_format ( $filtrev, 2, '.', ',' );
                                $totrev = $objPHPExcel->getActiveSheet()->getCell('I26')->getCalculatedValue();
                                $totrev = number_format ( $totrev, 2, '.', ',' );
                        <td align="center" valign="middle" height="30">&pound;<?php echo $custrev; ?></td>
                        <td align="center" valign="middle" height="30">&pound;<?php echo $filtrev; ?></td>
                        <td align="right" valign="middle" height="30"><strong><span class="orange">Revenue<br />Difference</span></strong></td>
                        <td colspan="2" align="center" valign="middle" height="30"><strong>&pound;<?php echo $totrev; ?></strong></td>

                <br /><br />

        <div class="right-right">
            <img src="images/logo.png" alt="FRAM Industrial">
            <h1 class="orange">Filter Life Calculation</h1>
            <p>This is the increased revenue prediction based around the filter life data previously estimated, this can be adjusted by going back to alter the estimated data.</p>
            <p>The graphs show a visual representation of the estimate average turbine efficiency loss curve, due to the filters pressure characteristic, over a desired time frame.</p>
            <div class="links">
                <a href="4-filter-life.php" class="back">Back</a>
                <a href="6-filter-class.php">Filter Class</a>

<?php include('inc/footer.php'); ?>
I've outputted the filename being used to the top of the page so if you got to: name of the file here
you can download and see the spreadsheet that it's currently working from,

Can anyone help with this?