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.
Related
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...
I have to code a PHP platform for importing an Excel file (quite heavy) to fill an SQL server database.
To do so I used the library PHP-excel-reader (https://code.google.com/archive/p/php-excel-reader/downloads) to be able recover the value of specific cells (eg $ water = $ data-> val (13, 'A');) everything works fine except that PHP-excel-reader is only compatible with .xls not .xlsx, if I go directly convert my files in excel no problem.
But so that the user does not have to do this operation every time I want automated converting .xls .xlsx has.
I tried to use PHPExcel (http://phpexcel.codeplex.com/) but nothing works all the file converted by the libraries do not work on PHP-excel-reader. Would you have a solution?
If there is no solution do you have knowledge of another library that allows like PHP to store the value of an Excel cell in a variable?
I am desperate. Thank you in advance for your help. Sorry for my English I'm french x)
For those interested, I found a solution. It is used the SimpleXLSX library (http://www.spyrozone.net/hacking/2011/05/php-parse-and-retrieve-data-from-xlsx-files.jsp), it will return from to an .xlsx an array of values where it will be to recover each cell value. if you have a problem with date conversion check this ( https://www.ablebits.com/office-addins-blog/2015/07/01/excel-convert-time-decimal/)
I want to add some style on a column using Laravel Excel. I know this column is the (let's say) 42nd, but I don't know the Excel code (like AA, BC, etc.).
I know I can build a function (based on this answer) to convert the column number to a letter, but I not sure it's the right way.
Is there a built-in way to convert a column number to an Excel column with Laravel Excel?
Since version 3.1 of Laravel Excel is based off of the newest PHP Excel which uses the latest PhpSpreadsheet classes, the helper functions to manipulate coordinates have been moved to a new dedicated class. Search for "Dedicated class to manipulate coordinates" on this page.
Therefore, you can do this moving forward:
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
...
Coordinate::stringFromColumnIndex(1);
There is a method in PHPExcel and i guess Laravel Excel uses that library.
You can do like this:
\PHPExcel_Cell::stringFromColumnIndex(1);
This will return, B
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
I have a php script that have to parse an excel file with some date and time to import in my mysql database
Screen of the xlsx file :
I'm using the PHPExcel library to read the file
When I get the cell value with getValue() method, it returns the formula =J4+"01:00:00" as showed in the excel formula field. Ok normal
When I use the the getCalculatedValue() method, it returns "#VALUE!". As excell / Libreoffice don't have any problem to calculate the formulas, I have no idea why the PHPExcel library is not able to calculate this quite simple formulas.
Do anyone had the same issue and know a trick to fix this issue ? Or do I realy have to tell users not use any formulas fort date fields type ?
I found the answer from the PHPExcel support platform.
The only way to manage this kind of formulase (date operation) is to replace my actual formulas by something like =J4+(1/24)
Source : PhpExcel support plateform