Open Source Python API for Google Sheets

Python library that makes it easy to call Python from Excel and vice versa.

Xlwings is an open source python API for manipulating Excel file format. Using the API you can automate excel from pyton to produce reports, write UDFs(user defined funcitons), write macros, and control Excel remotely. Furthermore, the API allows manipulating data structures like cells, lists, range, NumPy arrays, panda data frames, and panda series.

Xlwings requires installtion of Microsoft Excel, so everything works on Windows and macOS except that the UDFs only work on Windows.

Previous Next

Getting Started with Xlwings

You need to have Python 3.5 or higher installed on your system to run xlwings smoothly. The recommended way to install via PIP. Please use the following command.

pip install xlwings

Interact with Excel from Python

Xlwings API allows manipulating Microsoft Spreadsheets using Python. Using the API you can connect to an exisitng workbook or create a new one using xlwings.Book() method. You can read/write values to & from ranges, expand ranges, convert datatypes easily. Furthermore, you can add Matplotlib & Plotly chart as pictures in your Excel Workbooks.

Call Python from Excel

The Open Source spreadsheet library Xlwings allows software developers to communicated with Python via Excel. You can call python funcitons inside your excel either by using Run button of Xlwings Excel Add-In or by using the RunPython VBA funciton. The good thing about using Excel Add-In is that you dont need your workbooks to be macro-enabled, and you can save it as xlsx.

User Defined Functions (UDFs) in Excel using Python

Xlwings library gives developers the capability to write User Defined Funcitons (UDFs) inside Microsoft Excel fileformat programatically. Currently, UDFs are only available on windows. The API allows using simple funcitons, number of array dimensions, dynamic array formulas, arrya formulas with NumPy and more.