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
- I opened excel, imported the functions using import function in xlwings addin. I found no errors in importing the functions
- I called the functions from the excel cell, "=exponent(A1,B1)"
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.