Related topics
×
Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Python in Excel is currently in preview and is subject to change based on the feedback. To use this feature, join the Microsoft 365 Insider Program and choose the Beta Channel Insider level.

Python in Excel is gradually rolling out to Excel for Windows customers using the Beta Channel. At this time, the feature is not available on other platforms.

If you encounter any issues 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.

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.

Gensim

A topic modelling and natural language processing library. License: LGPL-2.1.

Matplotlib

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

NetworkX

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

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.

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.

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.

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.

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.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×