xlwings
Run Python code directly in Excel without a local Python installation.
link - xlwings.org/
The xlwings add-in is the preferred way to be able to use the Run main button, RunPython or UDFs.
You don't need an add-in if you just want to manipulate Excel by running a Python script.
The Run main button is the easiest way to run your Python code.
It runs a function called main in a Python module that has the same name as your workbook.
This allows you to save your workbook as xlsx without enabling macros.
The xlwings quickstart command will create a workbook that will automatically work with the Run button.
xlwings requires at least Python 3.9.
To install the add-in
xlwings addin install
This will copy the add-in from Python's installation directory to Excel's XLSTART folder.
Then, to use RunPython or UDFs in a workbook, you need to set a reference to xlwings in the VBA editor.
Note that when you create a workbook via xlwings quickstart, the reference should already be set.
When you install the add-in for the first time, it will get auto-configured and therefore, a quickstart project should work out of the box.
© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited Top