vinci1it2000 / formulas

Excel formulas interpreter in Python.
https://formulas.readthedocs.io/
European Union Public License 1.1
342 stars 75 forks source link

How to create a custom function that calls .xll file? #102

Open swordfish81 opened 2 years ago

swordfish81 commented 2 years ago

Hi, how can one create a custom excel function in Python which calls an xll file? Example, I found this in the closed issues

from formulas.functions import get_functions
get_functions()['MYFUNC'] = lambda x, y: 1 + y + x
func = formulas.Parser().ast('=MYFUNC(1, 2)')[1].compile()
func()
4

But the above is for creating standard function.

Example In excel, I have a custom function called =mycustomfunction, which takes few variables and does what it needs to do. It uses a xll file to do its thing.

How to incorporate this into Python?