1

I am trying to figure out how to use Python-based functions in excel. I came across Pyxll which can make Python add-ins instead of using VBA. But Pyxll is not free after their 30-day trial.

I also came across xlwings which worked fine and served the purpose of adding udfs in excel, the problem is--- it is not very user-friendly. I have to put the excel file in the same folder as the python file plus, they should also have the same names with different extensions. Or I may use the xlwings quickstart command to do that.

This means I have to create such folders everytime I wish to include my python based functions in a new excel project file and copy paste the functions from the previous python files to the newly created quickstart files.

I was wondering if there is any way to use only one python file to import user-defined functions using xlwings or perhaps a different library/module which is free to use and does that?

(PS: According to the xlwings documentation, we can point to a udf module under the xlwings tab in excel but even after many attempts I am not able to make it work )

YLR
  • 1,503
  • 4
  • 21
  • 28
rdalie
  • 11
  • 3
  • 1
    With xlwings, you will need to set the `PYTHONPATH` to the folder of where your module is and need to add the name of the module, as you saw, to `UDF modules`. See: https://docs.xlwings.org/en/stable/addin.html#user-settings – Felix Zumstein Dec 16 '20 at 14:40
  • Wow! It worked! Thanks a lot :D – rdalie Dec 16 '20 at 18:40

0 Answers0