Excel and Python for Financial Modelling: Installation Guide
Building powerful models with Microsoft Excel and Python
This article provides an installation guide for running Python through Excel. This is achieved via xlwings, which is a Python library and Excel add-in. It is assumed that Excel and Python are already installed on your computer. For readers that do not have Python yet we have provided a link, which guides the user through the installation process.
Python installation guide
First Python has to be installed. We recommend installing Anaconda, which is a free and open-source distribution already containing all packages for mathematics, science, engineering and data science.
Datacamp has an excellent tutorial on how to install the Python – Anaconda package manager on Microsoft Windows – the tutorial can be found here.
Second, install Python packages pandas and xlwings. To do this open the Anaconda prompt – make sure to run the prompt as an administrator. The code to install them is simple – in the prompt type:
conda install pandas
conda install xlwings
This is all that is required to install the pandas and xlwings packages in Python.
VBA installation guide
The last step is for the xlwings add-in to be added to Excel. Open the command prompt (make sure to run this as an administrator) and type:
xlwings addin install
After opening Excel, the xlwings add-in will be shown on the Excel ribbon as per below:
The official xlwings add-in installation guide can be found here.