I've built a reporting solution where the data can be exported as Excel. Using PHPExcel, this work's beautifully. But, we had a need to build dashboard style template sheets and have them inserted into the output at runtime, including formulas. I have all of that working fine, my issue is that sometimes these dashboard templates are fairly complex and PHPExcel chokes on the formula's when it tries to output.
I've spent a considerable amount of time finding workarounds and even went as far as forking my own branch and adding a method of disabling calculation that would try to stop the formulas from being processed, but could not get it to work. I've also tried disabling calculation cache.
@MarkBaker has done a fantastic job with this library, and I have seen multiple times where he has mentioned this is not designed for modifying files, but if done very carefully, it seems to work.
My issue is, how can I tell PHPExcel to stop trying to calculate formulas? I want it to treat them just like any other text value and let Excel itself handle validation. Is this possible?
As an example, here is a formula that PHPExcel appears to not like:
=IFERROR(IF($L$3="UNITS",COUNTIF('K1_Current_Accounts'!$M$2:$M$10000,'Snapshot Summary'!H5)+COUNTIF('K1_Current_Available'!$M$2:$M$10000,'Snapshot Summary'!H5),IF($L$3="Cost Basis",SUMIF('K1_Current_Accounts'!$M$2:$M$10000,'Snapshot Summary'!H5,'K1_Current_Accounts'!$E$2:$E$10000)+SUMIF('K1_Current_Available'!$M$2:$M$10000,'Snapshot Summary'!H5,'K1_Current_Available'!$E$2:$E$10000),IF($L$3="Notes",SUMIFS('K1_Current_Accounts'!$AA$2:$AA$10000,'K1_Current_Accounts'!$M$2:$M$10000,'Snapshot Summary'!H5,'K1_Current_Accounts'!$R$2:$R$10000,'Snapshot Summary'!$A$7)+SUMIFS('K1_Current_Accounts'!$AA$2:$AA$10000,'K1_Current_Accounts'!$M$2:$M$10000,'Snapshot Summary'!H5,'K1_Current_Accounts'!$R$2:$R$10000,'Snapshot Summary'!$A$8)+SUMIFS('K1_Current_Accounts'!$AA$2:$AA$10000,'K1_Current_Accounts'!$M$2:$M$10000,'Snapshot Summary'!H5,'K1_Current_Accounts'!$R$2:$R$10000,'Snapshot Summary'!$A$9),IF($L$3="Cash",SUMIFS('K1_Historical_Accounts'!$AC$2:$AC$10000,'K1_Historical_Accounts'!$M$2:$M$10000,'Snapshot Summary'!H5,'K1_Historical_Accounts'!$R$2:$R$10000,'Snapshot Summary'!$A$10))))),"")
I read that SUMIFS
can cause problems, but I have no clue how to refactor those to SUMPRODUCT
as suggested (these dashboards are built by business development teams). Also, we have our ranges for columns go to like 10000 because ranges like A:A do not work either. They work fine in Excel, so if I could just get PHPExcel to stop trying to validate everything and just let it through, my life will be glorious!
EDIT
Looking further at the stack trace, it seems to start happening when it tries to write a chart:
EDIT 2
Looking at the chart generation as the source of this problem, there is only one chart and it's data source is ='Sales History'!$Y$4:$CR$5
, which I can see it for sure tries to process, but that shouldn't cause an issue as it is a relatively simple reference.