Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run excel formula from php

Here's my clients scenario my client wants to put a excel file on server now from a PHP form sends data to the file runs a formula in this excel file and get the results.

I don't know if this is possible. If so direct me to a library best was PHP, or some other possible solutions.

like image 577
adam Avatar asked Oct 14 '25 18:10

adam


1 Answers

It's perfectly possible: take a look at the PHPExcel library which has a built-in calculation engine for handling most Excel formulae

There's an example of populating an Excel file with data (in this case from a form input) then rendering a formula in that Excel file to generate a result an ddisplaying it to a web browser in the /Tests/ directory of the distribution. This simple example /Quadratic.php solves a quadratic equation; but the principle is similar enough

EDIT

See my response to this question for some indication of the limitations of PHPExcel's calculation engine

EDIT 2

The PHPExcel is deprecated, hence now you can use PhpSpreadsheet

like image 124
Mark Baker Avatar answered Oct 17 '25 08:10

Mark Baker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!