[
    {
        "role": "user",
        "content": "I%20hear%20there%27s%20new%20python%20support%20in%20excel.%20how%20do%20i%20access%20python%20from%20within%20excel%20now%3F"
    },
    {
        "role": "assistant",
        "content": "Here\u2019s a guide to using the new *Python in Excel* feature\u2014including how to check if it\u2019s available for you, how to use it, and what to expect. This is built into modern Microsoft 365 / Office versions\u2014not the old offline Office versions\u2014and it\u2019s not the same as add-ons like xlwings or PyXLL (which are still useful in other contexts).\n\n---\n\n## What Is Python in Excel\n\n- Microsoft has added **native Python support** to Excel, powered by Anaconda and running in the Microsoft Cloud. ([techcommunity.microsoft.com](https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439?utm_source=openai))  \n- It lets you run Python code directly inside cells using the `=PY(...)` function, visualize data using libraries like pandas, Matplotlib, seaborn, etc., and reference Excel tables or Power Query queries inside that Python environment. ([support.microsoft.com](https://support.microsoft.com/en-us/office/use-power-query-to-import-data-for-python-in-excel-028dbcd4-76c5-4aa4-831d-0e211fefc0a2?utm_source=openai))  \n\n---\n\n## Is It Available to You?\n\nYou\u2019ll need certain versions of Excel and a qualifying Microsoft 365 subscription:\n\n- **Windows**: Enterprise and Business users with Microsoft 365 on the *Current Channel*, starting with Version **2408 (Build 17928.20114)**, or later. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))  \n- **Mac**: Available from Version **16.96 (Build 25041326)** for Enterprise/Business, with preview access on newer builds for Personal/Education users. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))  \n- **Web version** of Excel also supports it for Business and Enterprise users. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))  \n\nExcluded are:\n\n- Excel for iPad, iPhone, and Android. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))  \n- Device-based Microsoft licences (instead of user-based). ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))  \n\nAlso, *Personal* and *Family* subscription tiers are in **preview mode**, so functionality may be limited. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))  \n\n---\n\n## Enabling Python in Excel\n\nIf your version of Excel supports it, here\u2019s how to get started:\n\n1. **Update Excel**  \n   Make sure you\u2019re running the required build. On Windows, that's version 2408+ with the specific build number above. On Mac, version 16.96+. If you\u2019re on *Personal*, \u201cFamily\u201d, or \u201cEducation\u201d, you may need to join an Insider or Beta channel to get preview builds. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))\n\n2. **Check your subscription/license**  \n   You\u2019ll need a Microsoft 365 subscription that supports it (usually Business, Enterprise, or qualifying Personal/Education with preview access). Some compute features (like \u201cpremium compute\u201d speeds) might require additional licensing. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))\n\n3. **Make sure connected experiences are enabled**  \n   Python in Excel relies on Excel being connected to Microsoft 365. So your macOS or Windows Excel App must be signed in and properly activated. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))\n\n---\n\n## How to Use Python in Excel\n\nOnce everything is set up:\n\n- **Enter Python code** by typing `=PY(` in a cell, or via the \u201cInsert Python\u201d button in the *Formulas* ribbon. ([techcommunity.microsoft.com](https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439?utm_source=openai))  \n- To reference Excel data inside Python, use the `xl()` function. For example, if you have a query or a named table called *SalesData*, `xl(\"SalesData\")` will import it into Python as a DataFrame. ([support.microsoft.com](https://support.microsoft.com/en-us/office/use-power-query-to-import-data-for-python-in-excel-028dbcd4-76c5-4aa4-831d-0e211fefc0a2?utm_source=openai))  \n- Visualizations, data cleaning, missing value detection, and basic machine learning built-ins are supported via libraries like pandas, Matplotlib, seaborn, scikit-learn, etc. ([techcommunity.microsoft.com](https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439?utm_source=openai))  \n\n---\n\n## Limits & Considerations\n\n- **Runs in the cloud**: Your Python code is executed server-side. You won\u2019t have full system-level access (eg. to your local files), and internet access may be restricted. ([techcommunity.microsoft.com](https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439?utm_source=openai))  \n- **Premium vs standard compute**: You're given standard compute with your subscription; faster (& more flexible) computation modes require a premium add-on licence. ([support.microsoft.com](https://support.microsoft.com/en-au/office/python-in-excel-availability-781383e6-86b9-4156-84fb-93e786f7cab0?utm_source=openai))  \n- **Libraries support**: The most popular data science libraries are included, but you can\u2019t install arbitrary ones like you might locally\u2014especially ones that need system dependencies. ([techcommunity.microsoft.com](https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439?utm_source=openai))  \n\n---\n\n## Practical Workflow Example\n\n1. Use **Power Query** or *Get & Transform Data* to import an external dataset\u2014CSV, database, or web API. ([support.microsoft.com](https://support.microsoft.com/en-us/office/use-power-query-to-import-data-for-python-in-excel-028dbcd4-76c5-4aa4-831d-0e211fefc0a2?utm_source=openai))  \n2. In the worksheet, click *Formulas \u2192 Insert Python*, or type `=PY(` in a cell.  \n3. In that Python cell:  \n   ```python\n   import pandas as pd\n   df = xl(\"Categories\")  # data from a Power Query query called Categories\n   df[\"Name\"].value_counts()  # as an example operation\n   ```\n4. Press Enter, and the output (e.g. a DataFrame or plot) appears right in Excel. Plots are rendered inside the workbook. ([support.microsoft.com](https://support.microsoft.com/en-us/office/use-power-query-to-import-data-for-python-in-excel-028dbcd4-76c5-4aa4-831d-0e211fefc0a2?utm_source=openai))  \n\n---\n\nIf you tell me which Excel subscription and build version you're using already, I can help you figure out if it\u2019s available *now* on your machine\u2014and walk you through enabling it if not."
    }
]