Running Pandas, Scikit-learn, and Matplotlib directly inside Excel cells — bringing full data science capability to business analysts without IT involvement.
A supply chain analyst needs to forecast demand for 200 SKUs across 6 warehouses. The data lives in Excel. The data science team built a Python forecasting model — but deploying it requires IT involvement, a Python environment, and a process the analyst cannot run independently. Every forecast update requires a 3-day turnaround.
Using Python in Excel (powered by Anaconda in the cloud), the analyst runs the full forecasting pipeline inside a spreadsheet cell — no separate environment needed.
import pandas as pd
from prophet import Prophet
# xl() reads directly from the Excel Table named SalesHistory
df = xl("SalesHistory[#All]", headers=True)
df.columns = ["ds", "y"]
df["ds"] = pd.to_datetime(df["ds"])
model = Prophet(yearly_seasonality=True)
model.fit(df)
future = model.make_future_dataframe(periods=90)
forecast = model.predict(future)
# Returns dynamic array back to Excel
forecast[["ds","yhat","yhat_lower","yhat_upper"]].tail(90)
import matplotlib.pyplot as plt, matplotlib
matplotlib.use("Agg")
fig, ax = plt.subplots(figsize=(10, 4))
ax.plot(df["ds"], df["y"], label="Actual", color="#6366f1", linewidth=1.5)
ax.plot(forecast["ds"], forecast["yhat"],
label="Forecast", color="#06b6d4", linewidth=2, linestyle="--")
ax.fill_between(forecast["ds"],
forecast["yhat_lower"], forecast["yhat_upper"],
alpha=0.15, color="#06b6d4")
ax.set_title("90-Day Demand Forecast", fontsize=13, fontweight="bold")
ax.legend(); ax.grid(True, alpha=0.2)
plt.tight_layout()
plt.show() # Renders as image directly in the Excel cell