Python in Excel initialization settings
Applies To
For 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. 
Initialization settings task pane
Python in Excel offers an initialization settings task pane. This task pane allows you to control and create universal Python settings for a workbook.
The initialization settings in one workbook don't impact the initialization settings in another workbook, even if you have both workbooks open at the same time.
Note:Â In Python projects on a local machine, initialization settings are commonly saved in a file called init.py. The Python in Excel initialization settings task pane functions similarly to an init.py file.
Access the task pane
To open the initialization settings task pane, go to the Formulas tab and select Initialization in the Python section.
Default settings
The initialization settings task pane includes the following statements and comments by default. Some of these statements are required and should not be removed, and some of the statements are editable. See the following Required settings and Editable settings sections for additional information.
# The following import statements are pre-loaded. import numpy as np import pandas as pd import matplotlib.pyplot as plt import statsmodels as sm import seaborn as sns import excel import warnings warnings.simplefilter('ignore')
# Set default conversions for the xl() function. excel.set_xl_scalar_conversion(excel.convert_to_scalar) excel.set_xl_array_conversion(excel.convert_to_dataframe)
Required settings
The initialization settings task pane contains some statements that are required for Python in Excel to calculate correctly.
Important:Â Removing the following statements is not recommended. These settings control how Excel runs Python formulas. Removing these statements may cause errors.
import excel import warnings warnings.simplefilter('ignore') excel.set_xl_scalar_conversion(...) excel.set_xl_array_conversion(...)
Editable settings
The initialization settings task pane includes the following import statements for the NumPy, pandas, Matplotlib, statsmodels, and seaborn libraries by default.
import numpy as np import pandas as pd import matplotlib.pyplot as plt import statsmodels as sm import seaborn as sns
You can add import statements for additional libraries and edit or remove these existing open-source library import statements if desired. See Open-source libraries and Python in Excel for information about available libraries.
Note: Changing initialization settings affects how Python behaves in your workbook. Any changes can impact both Python in Excel and Copilot in Excel with Python.
Related articles
Open-source libraries and Python in Excel
Data security and Python in Excel​​​​​​​