How do I use the new Python in Excel integration for advanced Data Science forecasting?
I just got the 'Python' button in my Excel ribbon! I want to use it to run a Random Forest regression for sales forecasting directly in my spreadsheet instead of exporting everything to a Jupyter Notebook. Has anyone successfully used the 'pandas' and 'scikit-learn' libraries inside Excel yet? How do you handle the data privacy of these cloud-based computations?
2025-02-05 in Data Science by James Wilson
| 15729 Views
All answers to this question.
I’ve been experimenting with Python in Excel for a few months now. It’s fantastic for visualization because you can use Seaborn and Matplotlib directly in the grid. To run a Random Forest, you just use the =PY() function. The integration uses an Anaconda distribution running in the Microsoft Cloud, which means your local machine isn't doing the heavy lifting. Regarding privacy, the data is sent to a secure container and isn't used to train any models, but you should still check with your IT department if you're handling sensitive PII (Personally Identifiable Information).
Answered 2025-02-08 by Kimberly Adams
Does the Python integration support external API calls? I’d love to pull real-time weather data into my sales forecast model without having to set up a separate Power BI or Python script.
Answered 2025-02-11 by Brian O'Connor
-
Brian, unfortunately, external network calls are disabled in Python in Excel for security reasons. You have to use Power Query to pull the API data into a table first, and then point your Python code to that table. It’s a bit of an extra step, but it keeps the environment secure. I’ve used this method to pull stock prices and then run a Monte Carlo simulation in Python to predict portfolio risk, all within a standard .xlsx file.
Commented 2025-02-14 by James Wilson
The best part is that you can return Python objects as Excel values. Converting a dataframe into an Excel table with one click is a massive workflow improvement for us.
Answered 2025-02-17 by Sarah Connor
-
Exactly, Sarah. Being able to toggle between a "Python Object" and "Excel Value" makes it so much easier to present the final results to stakeholders who don't know how to code.
Commented 2025-02-20 by Kimberly Adams
Write a Comment
Your email address will not be published. Required fields are marked (*)

