I want to modify an already existing excel sheet with delete the formula without affecting the values in the cell which are generated by those formula used in the sheets using PHP.
I tried to use php Spreadsheet. Not able to delete the formula used the excel sheets
Is there some way I can modify the already existing excel sheet with removing the formula using PHP?
Related
I want to modify an already existing excel sheet with delete the formula used in the sheets using PHP.
I tried to use php Spreadsheet. Not able to delete the formula used the excel sheets
Is there some way I can modify the already existing excel sheet with removing the formula using 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...
I am currently facing one issue. I have an excel sheet with some particular formatting. I have to make a program which can read the data from the sheet and analyze it from my database, fetch some more data and write back to the same sheet.
I know how to read and write using PHPExcel. But I don't know how to write on a given sheet.
At the moment of this writing the current version of PHPExcel is version 1.8.0. I know how to make a chart and embed it in a worksheet, I basically followed the provided example.
Excel allows to either embed a chart into a worksheet or otherwise make a chart sheet. A chart sheet has it's own 'tab' in Excel and Excel keeps the chart scaled to the available size in the window.
Now what I would like to know is: how to add a chart sheet with PHPExcel? Is this possible with PHPExcel 1.8.0 using the 'Excel2007' writer?
As stated by #MarkBaker in the comments, the answer is simply "No" (at least not in version 1.8.1).
In my use case I was using PHP to generate an Excel workbook based on some processed data from different sources. What I did is to add VBA in Sub Workbook_Open() on the generated workbook to move the chart from a worksheet to it's own chart sheet. Then I used PHPExcel->getMacrosCode() to export the binary string of macro code to some file.
Now when generating files I add that binary string with PHPExcel->getMacrosCode(String) and save it as .xlsm instead of .xlsx. It is a bit of a hassle, but this is how I work around this problem for me.
Note that depending on your use case you might also need to generate a certificate to sign the code, to allow your user to always trust macros.
I have a table which has data already with many fields. Now I want to add another field and for that field I want import data from Excel sheet. Is it possible to import data from Excel sheet to an already existing table or should I create a new table for importing data from Excel sheet?
You might want to take a look at PHPExcel - i's a library that lets you create new Excel files and read existing Excel files. It's very well documented, you shouldn't have any problems.
Once you've retrieved your data from the Excel file, use a simple INSERT INTO statement to insert these data in your database.
Good luck! :)