Python in Excel lets you run Python code in spreadsheet cells using Excel’s =PY() function. The code runs in a Microsoft Cloud container, and the xl() function brings supported workbook data into Python. That makes it easier to use Python for analysis while working in a familiar spreadsheet—but it does not turn Excel into an unrestricted local Python environment or replace every notebook and data-science workflow.
What is Python in Excel?
Python in Excel is a Microsoft 365 feature for writing Python code in a workbook and returning its results to Excel. Rather than running on your computer, the code runs in a secure container in the Microsoft Cloud. You can use xl() to reference supported workbook data, then return Python output to a cell.
The practical change is the bridge it creates between spreadsheet work and Python analysis. People who already collaborate in Excel can use Python libraries for data manipulation, statistical work, and visualizations without switching to a separate coding interface for every step. The trade-off is that execution, data access, and available packages are governed by the cloud service and its curated environment.
How do you use Python in Excel?
- Open a workbook in a supported version of Excel and enter a Python formula using
=PY(). - In the Python editor, write code and use
xl()to reference data in the workbook. For example, the code can use a range or data exposed under a Power Query connection name. - Run the formula. Python executes in the Microsoft Cloud container, and the result is returned to the workbook.
Think of the workbook as the place where input data is organized and results are shared, not as a window into your computer’s file system. A Python formula cannot return a macro, VBA, or another formula, and Python code cannot access charts, PivotTables, macros, or VBA objects.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- The Microsoft Office 365 Bible: The Most Updated and Complete Guide to Excel, Word, PowerPoint, Outlook, OneNote, OneDrive, Teams, Access, and Publisher from Beginners to Advanced
- ABIS BOOK
Which Python libraries work in Excel?
Python in Excel uses a curated Anaconda environment. Microsoft lists pandas, NumPy, Matplotlib, seaborn, and statsmodels among the default or recommended libraries. Other packages are available within that curated environment; this is not the same as being able to install any package you choose from the internet.
- pandas and NumPy: common tools for working with tabular data and numerical operations.
- Matplotlib and seaborn: libraries for creating data visualizations.
- statsmodels: a library for statistical analysis and modeling.
Microsoft’s documentation describes the supported environment and its boundaries; package availability should not be assumed to match a user’s local Python installation.
Can Python in Excel read CSV files or connect to the internet?
Not directly from Python code. The cloud container has no network access and cannot read files from your local computer. A workflow that starts with a CSV, database, or API must first bring the data into the workbook through a supported Excel mechanism, such as a Power Query connection; Python can then work with data exposed in the workbook through xl().
This division matters when choosing a workflow: Python in Excel can analyze data that Excel has made available, but it is not the step that independently fetches arbitrary web data or opens a local file. Microsoft documents workbook references and Power Query connection names as supported routes for getting data to Python.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Rank #3
Is Python in Excel secure?
Microsoft says Python in Excel runs in a secure Microsoft Cloud container with enterprise-level security. Its documentation says the containers are hypervisor-isolated, operate within the organization’s compliance boundary, do not persist data at rest, and cannot access the local computer, devices, user token, or network. Microsoft also says data is not shared with Anaconda or other third parties and is not used for Copilot AI training.
Those controls describe the service’s execution boundaries; they are not a reason to ignore an organization’s own data-handling rules. In particular, Excel Protected View prevents Python formulas from running in workbooks originating from the internet, and Microsoft Defender Application Guard also blocks them by default. Follow your organization’s security and compliance policies when deciding what data belongs in a workbook.
Rank #4
Is Python in Excel free, and which Microsoft 365 plans support it?
There is no single yes-or-no answer: eligibility and compute depend on the subscription, account scenario, platform, and whether premium compute is needed. Microsoft’s availability guidance distinguishes broad business and enterprise access from preview availability for some consumer and education users. It does not establish an exhaustive list of qualifying plan names here, so check the current Microsoft eligibility guidance for a particular subscription.
| Access or compute | What Microsoft’s guidance establishes |
|---|---|
| Standard compute | Included with qualifying paid Microsoft 365 subscriptions; automatic calculation is available. |
| Full premium compute | Requires the Python in Excel add-on license or an administrator purchase. Premium compute allowances reset monthly. |
| Manual or partial recalculation | Requires the Python in Excel add-on license or an administrator purchase. |
| Excluded licensing scenarios | Free consumer and perpetual licenses, device-based licenses, and shared-computer-activation scenarios are excluded. |
For availability, Microsoft documents enterprise and business access on supported Windows channels and Excel for the web, with Mac availability dependent on the documented build. Consumer and education access is described as preview in specified channels. The exact channel and build matter, so a feature not appearing in one installation does not by itself establish that the account is ineligible.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesBest Value
Why doesn’t Python in Excel work on iPad or Android?
Excel for iPad, iPhone, and Android does not support Python in Excel. A workbook containing Python cells can be viewed on those devices, but recalculating those cells produces an error. Use a supported desktop or web version for Python execution; mobile viewing is not equivalent to mobile support for running the code.
Does Python in Excel replace Jupyter or desktop Python?
Not universally. Python in Excel is a strong fit when analysis needs to sit alongside workbook data and spreadsheet collaboration. A local Python environment or notebook is a better fit when the work requires local-file or network access, greater control over package installation or runtime, or capabilities beyond the workbook’s supported objects.
| Decision factor | Python in Excel | Local Python or notebook |
|---|---|---|
| Workbook collaboration | Works within an Excel workbook and its familiar sharing workflow. | May require a separate way to share code, data, and results. |
| Data access | Uses supported workbook references and connections; no local-file or network access from Python code. | Can be more suitable when local files or network connections are required, subject to the environment’s own controls. |
| Libraries and runtime | Uses a curated Anaconda environment; premium compute and recalculation options are subject to licensing. | Can offer more direct control over the installed environment and runtime. |
| Platform and governance | Availability depends on Microsoft 365 eligibility and supported Excel channels; execution is cloud-based. | Depends on the chosen installation or hosting arrangement and its governance. |
That comparison is about fit, not a claim that one tool is always faster or more reproducible. Heavy or iterative work should account for premium-compute licensing and monthly allowances; teams that need tightly controlled package versions or unrestricted inputs may prefer a separately managed Python environment.
What does Python in Excel change for data science?
It lowers the friction of bringing Python analysis into spreadsheet-centered work. Analysts can use familiar Excel workbooks as the collaboration surface while applying selected Python libraries to workbook data. That can make Python more accessible to spreadsheet users and reduce the need to move routine analysis into a separate interface.
Recommended Free Tools
It does not remove the distinctions between spreadsheet analysis and a full Python development workflow. Cloud execution, supported data inputs, a curated package environment, platform coverage, and subscription limits still shape what is practical. Anaconda announced general availability of Python in Excel on September 16, 2024, and promotes training called “Anaconda Certified: Data Analysis with Python in Excel,” taught by Microsoft Excel MVP and Python expert David Langer.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

