I'm using xlwings to expose python functions as user defined functions within Excel. It works perfectly if the excel file is in the same directory as the .py file which contains my UDF functions.
I would like to save my Excel file anywhere and just update my xlwings.conf file to have the location of the python module which contains the udf definitions.
If I set the conf file to have
"UDF MODULES","C:\src\xlwings_wrapper\xlwings_udfs"
I get the following error ModuleNotFound: No module named 'C:\src\xlwings_wrapper\xlwings_udfs'. How ever I have checked and the xlwings_udfs.py file is in that location.
Does anyone know if setting an absolute path for the UDF Modules is supported by xlwings?
Thanks David
Have a look at the docs where the settings are explained: The UDF_MODULES
only accept the module name. The path to where the modules are is set (and explained) under PYTHONPATH
. So in your example you have to set the following:
"UDF MODULES","name_of_module"
"PYTHONPATH","C:\src\xlwings_wrapper\xlwings_udfs"