Applies ToExcel for Microsoft 365 Excel for the web Office for business Microsoft Office

Python in Excel is 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 also available in Excel on the web for Enterprise and Business users. Python in Excel is available in preview for Family and Personal users in Excel on the web or running the Current Channel on Windows starting with Version 2405 (Build 17628.20164). It's 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.

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

Astropy

A Python library for astronomy. License: BSD-3-Clause.

beautifulsoup4

A Python library designed for screen-scraping. License: MIT.

Faker

Generates fake data. License: MIT.

imbalanced-learn

Helps tackle classification issues by offering re-sampling techniques. Relies on scikit-learn. License: MIT.

IPython

A library for interactive computing. License: BSD-3-Clause.

Matplotlib

Creates publication-quality charts and figures in Python. License: PSF.

mlxtend

A machine learning library for day-to-day data science tasks. License: BSD-3-Clause.

NetworkX

A Python package for creating and manipulating complex networks. License: BSD-3-Clause.

NLTK

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.

NumPy

Offers array processing for numbers, strings, records, and objects. License: BSD-3-Clause.

pandas

Offers data structures and data analysis tools. License: BSD-3-Clause.

Pillow

Adds support for opening, manipulating, and saving different image file formats. License: PIL.

plotnine

A plotting and data visualization library. License: MIT.

Prince

A library for multivariate exploratory data analysis in Python, including a variety of methods for summarizing tabular data. License: MIT.

PyTables

Brings together Python, the HDF5library, and the NumPylibrary to handle large amounts of data. License: BSD-3-Clause.

PyWavelets

A wavelet transforms library. License: MIT.

qrcode

A QR code image generator. License: BSD-3-Clause.

scikit-learn

A set of Python modules for machine learning and data mining. License: BSD-3-Clause.

SciPy

A scientific library for Python. License: BSD-3-Clause.

seaborn

A statistical data visualization library. License: BSD-3-Clause.

snowballstemmer

An algorithm library collection for Python. License: BSD-2-Clause.

squarify

Creates treemaps, or visualizations to display hierachical data. License: Apache v2.

statsmodels

Statistical computations and models, for use with the SciPylibrary. License: BSD-3-Clause.

SymPy

A Python library for symbolic mathematics. License: BSD-3-Clause.

tabulate

A library for creating and formatting tables. License: MIT.

TheFuzz

Offers fuzzy string matching to calculate the differences between sequences. License: MIT.

wordcloud

A word cloud generator. License: MIT.

Learn more from Anaconda

To learn more about the integration and supported libraries, visit Anaconda.

Related articles

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.