PHPExcel Crash with getCalculatedValue - php

I've been using PHPExcel for about a year to import data from spreadsheets in random cells. The code looks like this:
$value1 = test_input($objPHPExcel->getActiveSheet()->getCell('B13')->getCalculatedValue());
Recently, I changed the Excel sheets to run a more complex formula. The basic premise is that the sheet pulls data from a mySQL DB, which in turn is used in vlookups based on a dropdown to populate several fields. All relevant fields across the workbook are referenced on a final sheet for importing into the DB.
The problem now is that PHPExcel is crashing (diagnosing in NetBeans) when it comes to the cells with these calculated formulas. It works fine with most formulas, but when referencing cells which reference the cells with if > vlookup > ODBC link to mySQL, it crashes the program and stops the file import. Should I be using a different function, or what is causing it not to return the value?
Thanks in advance...

Related

phpexcel with Bloomberg

I am trying to create an Excel workbook using PHPExcel...
Everything works fine with most of the columns I'm creating.
However, the last column contains a formula (BDH) which belongs to Bloomberg's Excel Addin. This workbook will be used, of course, on a Bloomberg Terminal.
PHPExcel returns an error when I try to enter the Bloomberg formula on this column. I have successfully entered regular formulas in the column, so I assume the problem is that PHPExcel doesn't know the Bloomberg formula I am entering...
Any thoughts?
$Formula="=BDH(\"$My_Asset\" , \"px_last\" , \"$My_Date\" , \"$My_Date\" , \"$My_Overrides\" )";
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("G1",$Formula);
Thanks in advance!
You're correct in your assumption: PHPExcel will only work with functions that are "native" to Excel itself, not with functions that are added to Excel through external packs, nor with User-Defined functions. Nor is there any method of adding these non-native functions.

Export Mysql data to a customized XLS file using php

First of all, I do know the process of exporting MySQL data to excel file using php. But I have some specific requirement and I want to know if it can be done or not. I have already googled, but didn't get any specific information or method regarding the same.
This is my xls template :
Overview:
Column C is fixed and others are scrollable.
There are basically couple of organizations.
Data starting from COL-C8 to COL-L8 is exactly stored on a MySQL Table of an organization (e.g. Organization1).
Data of COL-C1 to COL-C5 & D1 to D5 is on another MySQL Table of Organization1.
So for every organization there are 2 different MySQL tables.
Requirement :
The goal is to export data from MySQL and add it to the excel file according to the image above.
Problem :
Adding data from MySQL table to excel is pretty easy if the requirement is to just replicate same on the excel sheet. But I have no idea how to do this customization.
Like pulling data from two different tables and adding them to different columns in an excel sheet.
Please let me know if it is possible. And if yes, then kindly direct me to some references on how to achieve this.
Thank You!
Try PHPExcel. This library allows you to read and write from/to .xls files.

countifs function with multiple conditions in excel file causes phpExcel to crash

I'm using phpExcel class in a project.
I created a model file with some formulas in its 2nd sheet which takes the data from 1st sheet. I'm writing all the data in the first sheet with phpExcel. Most of the formulas are working very well but there is one formula that causes a problem which is
=COUNTIFS(data!$R$2:$R$2000;"<>0";data!$R$2:$R$2000;"<=90")
for the Excel 2007, the syntax differs in newer verison of Excel like
=COUNTIFS(data!$R$2:$R$2000,"<>0",data!$R$2:$R$2000,"<=90")
I tried to write both formula to the cell with phpExcel also but it didn't work either. When I use this formula , I get no error or feedback , the script just stops working.
I would be glad if you could show me a way to solve this issue.
Regards
From the FunctionListByName.txt document in the PHPExcel /Documentation folder:
COUNTIFS CATEGORY_STATISTICAL *** Not yet Implemented

Export Excel calculator to php?

I have a financial calculator in MS excel, and I basically want to display it on my website. It's not a big database file or anything, it is a simple user interactive savings calculator. I know about the fgetcsv() function where I can import a csv file using php, but my excel file contains formulas and cell associations.
How could I import the excel calculator into php and display it on a webpage?
I would appreciate any advice.
Thanks
Take a look at PHPExcel, especially the Quadratic equation solvers in the /Tests directory... that will show you an example of how this can be done.
It isn't a mortgage calculator, but a form that accepts inputs from a user, uses those values to populate cells in a spreadsheet, accesses formulae defined in that spreadsheet, and displays the results of those calculations.

How to populate Excel Spreadsheet with MySQL Data using PHP

Let's go ahead and get this out of the way - i realize I can generate tables with php and mysql and output in 'almost' any format I need but in this scenario, the excel spreadsheet is formatted in some strange ways (layout, color, etc) and the client won't budge. I have to use the exact excel spreadsheet.
I am trying to pull data from a mysql database with php calculations behind it and populate various cells within an Excel file. Is it possible to do this?
Thank you ahead of time
You can try PHPExcel ( http://phpexcel.codeplex.com/). I think this is what you are looking for.

Categories