Reputation: 81
I'm a newbie into both python and xlwings. So the story is,
I need a custom function needs to be used in Excel. Since I have no clue about VB scripts, I decided to write a function in python and import it in excel using xlwings.
I installed xlwings using the pip command. I added the addin to excel by the procedure given in xlwings support forum.
I created an excel file, say " Test.xlsm". I created a python file in the same name "Test.py" (File is in same folder only)
I wrote my function in the python
import xlwings as xl
@xl.func
def exponent(x,y):
#the function is an example only. I tried this for practicing and it is also not working
z=x**y
return z
Instead of getting a result, I'm getting "Object Required" I don't know what went wrong?
Any ideas what I'm missing? Forgive me for the basic question.
Upvotes: 8
Views: 9287
Reputation: 920
You need to add the Reference in VBA.
Open up the Developer console (Alt-F11)
Click on Tools -> References and select xlwings
Upvotes: 21