Share via

How can I add Python ability in Excel?

Sayrak, Akin 0 Reputation points
2026-01-15T01:10:06.4133333+00:00

How can I add Python ability in Excel? I would like to build and run Python code while in an Excel spreadsheet.

Microsoft 365 and Office | Excel | For education | MacOS
0 comments No comments

3 answers

Sort by: Most helpful
  1. Dora-T 13,240 Reputation points Microsoft External Staff Moderator
    2026-01-15T03:38:02.43+00:00

    Hi Sayrak, Akin

    Thank you for reaching out to the Microsoft Q&A Forum. 

    I understand that you would like to add Python capabilities in Excel so you can build and run Python code directly in your spreadsheet. 

    Based on Microsoft documentation, Python in Excel is available for users with a paid Microsoft 365 consumer, commercial, or education license that provides access to the Microsoft 365 desktop apps (such as Office 365 E3 or E5). On Excel for Mac, this feature is supported for users running the Current Channel, starting with Version 16.96 (Build 25041326). 

    To use Python in Excel, please make sure your Excel version is updated to 16.96 or later and that you are signed in with an eligible Microsoft 365 account. 

    You can begin by selecting a cell and going to the Formulas tab, then choosing Insert Python, or simply entering =PY() in a cell to enable Python.

    User's image

    User's image

    You can refer to the following Microsoft documentation for more details:

    Python in Excel availability - Microsoft Support 

    Get started with Python in Excel - Microsoft Support 

    If you do not see the Python option in your Excel, please let me know which Microsoft 365 license you are using, your Excel version, and your macOS version, so I can assist you further.

    I hope this helps. If I have misunderstood your question, please feel free to correct me.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  2. Sayrak, Akin 0 Reputation points
    2026-01-15T01:14:45.0866667+00:00

    Please specify step by step what I need to do to make this work.

    Was this answer helpful?

    0 comments No comments

  3. Q&A Assist
    2026-01-15T01:10:14.1566667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To add Python capabilities in Excel, you can use the Power Query Editor in Power BI, which allows you to run Python scripts. Here are the steps to do so:

    1. Install the pandas library: Ensure that you have the pandas library installed in your Python environment. You can install it using the command pip install pandas.
    2. Use Power Query Editor: In Power BI, you can write and execute Python scripts within the Power Query Editor. This allows you to manipulate data using Python directly in your Excel workflows.
    3. Set Data Source Settings: Make sure that all Python data source settings are set to Public for the scripts to work properly. You can adjust these settings in Power BI Desktop under File > Options and settings > Data source settings.
    4. Run Python Scripts: You can create a new Python script in the Power Query Editor and run it to process your data as needed.

    This integration allows you to leverage Python's data manipulation capabilities alongside Excel's functionalities.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.