'Excel add-ins in Python
Is there any way I can make Excel add-ins/extensions using Python?
I have tried javascript but haven't found any result about making add-ins on python.
Solution 1:[1]
VSTO (or OfficeJS) doesn't provide anything for Python. There is no framework for Python developed by MS.
You may find custom extensions like PyXLL helpful.
Solution 2:[2]
You could try xlOil (disclaimer: I wrote it). The docs are here. To write a simple three input function, you would install xlOil using:
pip install xloil
xloil install
Then write:
import xloil
@xloil.func
def myfunc(x, y, z):
return x + y * z
Put this code either:
- In a py file in the same directory as your spreadsheet, named
Book1.py(if your sheet is calledBook1.xlsx) - In a py file on your python module path, then edit
%APPDATA%\xlOil\xlOil.inito load it as described in the docs.
Start Excel, open your spreadsheet and the function will be available as myfunc.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Eugene Astafiev |
| Solution 2 | stevecu |
