Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: Error when resolving formulas referencing other worksheets

$
0
0
Just for example, I have a sheet named "1" and a sheet named "2". In worksheet "2" there is a cell whose contents are the formula "='1'!F4".
$objPHPExcel->setActiveSheetIndexByName("2");
$sheetData = $objPHPExcel->getActiveSheet()->getCell('F4')->getValue();
var_dump($sheetData);
produces the following output:
string(5) "=1!F4" 
In addition, when I tried to load an entire sheet with
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
it initially gave me a Cyclical check, but then when I threw the following line into my code
PHPExcel_Calculation::getInstance()->cyclicFormulaCount = 1;
It would give me the following error (note, this is referring to worksheet '2' cell A2):
PHP Fatal error:  Uncaught exception 'PHPExcel_Exception' with message '2!A2 -> undefined variable '!'' in /var/www/Classes/PHPExcel/Cell.php:307
Stack trace:
#0 /var/www/Classes/PHPExcel/Worksheet.php(2415): PHPExcel_Cell->getCalculatedValue()
#1 /var/www/Classes/PHPExcel/Worksheet.php(2486): PHPExcel_Worksheet->rangeToArray('A1:AN180', NULL, true, true, true)
#2 /var/www/index.php(29): PHPExcel_Worksheet->toArray(NULL, true, true, true)
#3 {main}
  thrown in /var/www/Classes/PHPExcel/Cell.php on line 307
I'll add that I don't know what passing NULL, true, true, true to toArray does, but this same type of error (or correct functionality that I'm using incorrectly) occurs elsewhere, too.

As it stands, I have standardized spreadsheets so I can manually trace every reference and set the active sheet and cell and get the value, but.... that's a LOT of work when we have hundreds of cells referencing cells in other sheets that reference cells in other sheets that.....

Any help would be appreciated.

Thanks,
-Alex

Viewing all articles
Browse latest Browse all 2707

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>