Open-source libraries and Python in Excel
Applies To
Excel for Microsoft 365Python in Excel is now available to Enterprise and Business users running the Current Channel on Windows, starting with Version 2408 (Build 17928.20114), and Monthly Enterprise Channel on Windows, starting with Version 2408 (Build 17928.20216). It’s available in preview for Family and Personal users running the Current Channel on Windows starting with Version 2405 (Build 17628.20164). Python in Excel is available in preview for Education users running the Current Channel (Preview) through the Microsoft 365 Insider Program. It's not currently available for the Semi-Annual Enterprise Channel.
It's rolling out to Excel for Windows first, and then to other platforms at a later date. For more availability information, see Python in Excel availability.
If you encounter any concerns with Python in Excel, please report them by selecting Help > Feedback in Excel.
New to Python in Excel? Start with Introduction to Python in Excel and Get started with Python in Excel.
Open-source Python libraries
Python in Excel comes with a standard set of Python libraries provided by Anaconda through a secure distribution. Use these Python libraries to simplify your data analysis, find patterns and hidden insights, and visualize your data with plots.
Core Python in Excel libraries
The following open-source libraries are available with Python in Excel by default. They've been imported with the statements listed.
-
Matplotlib. Import statement: import matplotlib.pyplot as plt
-
NumPy. Import statement: import numpy as np
-
pandas. Import statement: import pandas as pd
-
seaborn. Import statement: import seaborn as sns
-
statsmodels. Import statement: import statsmodels as sm
Note: These core libraries are also listed in the Python in Excel initialization task pane. Access the initialization task pane by selecting Formulas > Initialization in the Excel ribbon. This task pane is currently read-only and shows the initialization settings for your Python in Excel runtime.
How to import libraries
In addition to the core libraries, you can import additional libraries available through Anaconda. Import Python libraries into Excel using a Python import statement in a Python in Excel cell, such as import numpy as np. This statement imports the NumPylibrary and assigns it the alias np. After entering this import statement into a Python cell, you can refer to the NumPy library as np throughout the Python formulas in that workbook.
Tip: To ensure that your libraries are imported before your Python formulas run, enter your import statements and any settings on the first worksheet in your workbook. If desired, you can reserve the first worksheet specifically for the import statements and settings.
Important: Not all libraries use the import statement format import [library] as [name]. For example, to import the beautifulsoup4 library, use the import statement from bs4 import BeautifulSoup. See the documentation for each library to learn the recommended import statement.
List of recommended libraries
The following table shows a subset of the open-source libraries provided by Anaconda that you can use with Python in Excel. The libraries Matplotlib, NumPy, seaborn, statsmodels, and pandasare imported by default. The additional libraries listed in the table are not automatically imported, but you can choose to import them if desired.
Important: To protect your data security, these libraries will not have the ability to make network requests or access your files and data on your local machine. To learn more, see Data Security and Python in Excel.
Note: Python in Excel supports English, Chinese (Simplified), French, German, Japanese, and Spanish fonts.
Library |
Description |
---|---|
A Python library for astronomy. License: BSD-3-Clause. |
|
A Python library designed for screen-scraping. License: MIT. |
|
Generates fake data. License: MIT. |
|
Helps tackle classification issues by offering re-sampling techniques. Relies on scikit-learn. License: MIT. |
|
A library for interactive computing. License: BSD-3-Clause. |
|
Creates publication-quality charts and figures in Python. License: PSF. |
|
A machine learning library for day-to-day data science tasks. License: BSD-3-Clause. |
|
A Python package for creating and manipulating complex networks. License: BSD-3-Clause. |
|
A library for natural language processing. The following corpora are pre-loaded for use with Python in Excel: brown, punkt, stopwords, treebank, vader, and wordnet2022. License: Apache v2. |
|
Offers array processing for numbers, strings, records, and objects. License: BSD-3-Clause. |
|
Offers data structures and data analysis tools. License: BSD-3-Clause. |
|
Adds support for opening, manipulating, and saving different image file formats. License: PIL. |
|
A plotting and data visualization library. License: MIT. |
|
A library for multivariate exploratory data analysis in Python, including a variety of methods for summarizing tabular data. License: MIT. |
|
Brings together Python, the HDF5library, and the NumPylibrary to handle large amounts of data. License: BSD-3-Clause. |
|
A wavelet transforms library. License: MIT. |
|
A QR code image generator. License: BSD-3-Clause. |
|
A set of Python modules for machine learning and data mining. License: BSD-3-Clause. |
|
A scientific library for Python. License: BSD-3-Clause. |
|
A statistical data visualization library. License: BSD-3-Clause. |
|
An algorithm library collection for Python. License: BSD-2-Clause. |
|
Creates treemaps, or visualizations to display hierachical data. License: Apache v2. |
|
Statistical computations and models, for use with the SciPylibrary. License: BSD-3-Clause. |
|
A Python library for symbolic mathematics. License: BSD-3-Clause. |
|
A library for creating and formatting tables. License: MIT. |
|
Offers fuzzy string matching to calculate the differences between sequences. License: MIT. |
|
A word cloud generator. License: MIT. |
Learn more from Anaconda
To learn more about the integration and supported libraries, visit Anaconda.