Copilot + Python in Excel: AI Chart Generation Deep Dive
How Copilot generates Python charts in Excel — matplotlib and seaborn output vs native charts, what it does well, where it fails, and when to use each.
Copilot + Python in Excel: AI Chart Generation Deep Dive
There are now two completely different ways Copilot can draw a chart in Excel, and most people don’t know the second one exists. The first is the one you’d expect: you ask, and Copilot inserts a normal Excel chart — a clustered column, a line, a pie. The second is newer, stranger, and far more powerful. Since the April 2026 update, when Python is enabled inside Edit with Copilot, you can ask Copilot to analyse your data and it will write and run Python, then drop a matplotlib or seaborn visual into your workbook. That’s not an Excel chart. It’s a rendered image produced by a data-science library running in Microsoft’s cloud.
That distinction matters more than Microsoft’s marketing lets on, because the two paths have opposite strengths and opposite failure modes. This guide is about the Python path specifically — what it charts brilliantly, what it charts badly, and when you should deliberately steer Copilot back to a native chart instead. If you want the broader picture of every way Copilot makes charts, start with our complete Copilot charts guide and come back here for the deep end.
What actually shipped, and when
Python in Excel itself isn’t new — Microsoft brought Python into the grid via the PY() function and the Anaconda distribution back in 2024, and made Copilot support for it generally available in 2025. What changed in April 2026 is the plumbing. Copilot moved from a “chat only” advisor to an editor that can act inside your workbook, controlled by a Chat/Edit switcher above the prompt box. Inside that Edit mode, Python became something Copilot can invoke directly — either because you asked for it (“use Python to analyse this”) or because Copilot decided the task warranted it.
That’s the honest version of the story. The upgrade is real, but it’s incremental: the Python engine was already there; April 2026 handed Copilot the keys to drive it as part of an edit rather than only suggesting code in a side pane. If you’re on a channel where you don’t see it yet, that’s normal — this rolled out in phases across the Windows, Mac, and web clients, and tenant timing varies.
The two chart engines, and why you should care
Here’s the mental model to hold onto. When you prompt Copilot for a visual, it can produce output from one of two engines:
Native Excel charts. These are the charts you already know. They live on the sheet as chart objects, they’re fully interactive, you can click a series and recolour it, and — crucially — they update when the underlying data changes. This is the same engine covered in our guide to PivotCharts in Excel.
Python-rendered charts. Copilot writes Python (using matplotlib, seaborn, or similar), runs it in Microsoft’s cloud sandbox, and returns the result. These render as images. They can show things native Excel simply can’t — boxplots, violin plots, pairplots, network graphs, heatmaps with real statistical structure. But they are pictures. They don’t respond to a click, and they don’t redraw when you edit a cell unless the Python recalculates.
Neither is “better.” They’re built for different jobs, and the entire skill of using this feature well is knowing which one you’re asking for.
What Python charting does genuinely well
This is where the feature earns its premium billing. Ask Copilot to “use Python to show the distribution of deal sizes by region” and you get a set of violin plots or boxplots that expose the shape of your data — spread, skew, outliers, clusters — in a way a native Excel chart would fumble. Excel has no native violin plot. It has no native pairplot. Getting a proper statistical heatmap out of native Excel means fighting conditional formatting into submission (we cover that battle in our heat map tutorial, and it is a battle).
The Python path also shines for:
- Exploratory analysis. When you don’t yet know what the data looks like, a pairplot across every numeric column is a genuinely fast way to spot correlations and dead ends. Native charts make you build one relationship at a time.
- Statistical visuals. Regression fits with confidence bands, distribution overlays, and density plots come out clean because the libraries were designed for exactly this.
- Chart types Excel doesn’t have. Network graphs, ridgeline plots, and multi-panel small-multiples are one prompt away instead of a lost afternoon.
- Large, messy datasets. Because the work runs in a cloud sandbox with the full pandas ecosystem, Copilot can reshape and plot data that would make the native chart engine sluggish — though there are real ceilings here, which we’ll get to.
For an analyst who wants to understand a dataset before presenting it, this is the strongest thing in Excel’s AI arsenal right now.
Where it falls down — and this is the part the marketing skips
Take a position on this feature and the position has to include its limits, or it’s just an ad.
The output is an image, not a chart. This is the single biggest trap. A colleague asks you to “just change the blue bars to green” on a Python-generated chart, and you can’t — not by clicking. You have to go back to the prompt or edit the Python. For anything that will be handed around, revised, or dropped into a live dashboard, that’s a serious drawback. Native charts win decisively here.
It doesn’t auto-update by default. When your data changes, a native chart redraws. A Python image sits there showing last week’s numbers until the code reruns. For a monthly report you rebuild from scratch, fine. For a dashboard that’s supposed to stay live, this quietly breaks the whole promise. If “updates itself” is the requirement, you want the techniques in our dynamic charts guide, not a rendered Python image.
It’s overkill for ordinary business charts. If the job is a clustered column of sales by month, invoking Python is slower, less flexible, and more fragile than just letting Copilot insert a native chart. Reach for Python when the chart type or the analysis is beyond native Excel — not as a default.
There are hard capacity ceilings. The cloud sandbox has limits. Very large workbooks — reports of trouble past the 100,000-row mark are common — can time out or refuse. The sandbox is powerful, not infinite.
Reproducibility depends on the model. Copilot’s Python is generated by whichever model is behind it (recent builds cite GPT-5.5 and Claude Opus 4.7), and the same prompt won’t always yield identical code. For a one-off exploration that’s harmless. For a process you need to run the same way every month, that variability is a reason to save and reuse the generated code rather than re-prompting.
Native vs Python charts: which to ask for
| If you need… | Ask for a… | Why |
|---|---|---|
| Sales by month, KPIs, standard reports | Native Excel chart | Interactive, editable, auto-updates |
| A dashboard that stays live | Native Excel chart | Python images go stale |
| Boxplot, violin, pairplot, network graph | Python chart | No native equivalent exists |
| Fast exploration of an unfamiliar dataset | Python chart | Small-multiples and pairplots in one prompt |
| Something a colleague will recolour or tweak | Native Excel chart | You can’t click-edit an image |
| Statistical visuals with fitted curves | Python chart | Libraries built for it |
| A chart on a 200,000-row workbook | Native chart, or reduce the data first | Sandbox ceilings |
How to actually drive it: prompt patterns
The feature rewards being explicit. A few patterns that work:
Force the engine you want. “Create a native Excel clustered column chart of revenue by quarter” keeps Copilot out of Python. “Use Python to plot the distribution of order values as a violin plot by region” forces it in. Naming the engine removes the guesswork.
Ask for the analysis, then the chart. “Analyse the relationship between marketing spend and revenue, then show it as a scatter with a fitted regression line” gets you a better result than “make a chart,” because you’ve told Copilot what the visual is for.
Request the code when you’ll reuse it. “Show me the Python you used” lets you save it into a PY() cell so next month’s run is identical instead of re-prompted. This is the fix for the reproducibility problem above.
Constrain the scope on big data. “Using only the last 12 months and the North America segment, use Python to…” keeps you under the sandbox ceiling and gets a faster answer.
A worked example: the same question, both ways
To make the trade-off concrete, take one question — “how do our deal sizes vary by sales region?” — and answer it through each engine.
The native route. You’d build a clustered column chart of average deal size by region. It’s clean, it’s interactive, it updates when a new deal lands, and your VP can click a bar to recolour it. What it hides is everything about distribution. Two regions can share an identical average while one is tight and predictable and the other swings wildly between tiny and enormous deals. The column chart flattens that into a single bar and quietly lies by omission.
The Python route. Prompt: “Use Python to show the distribution of deal sizes by region as a violin plot.” Copilot writes the seaborn code, runs it in the sandbox, and returns an image where each region is a shape whose width shows how deals cluster. Now the tight region and the volatile region look obviously different, because they are different — and that difference is often the actual insight the meeting needed.
Notice what happened. The native chart was the right answer for a dashboard — live, clickable, updating. The Python chart was the right answer for understanding — it exposed structure the native chart couldn’t. Same data, same question, two correct answers depending on what the chart is for. That’s the whole feature in one example, and it’s why “which engine” is the only decision that matters.
Now push it one step further. Say you want that violin plot in a monthly deck that refreshes automatically. That’s the trap: the Python image won’t refresh on its own. The move is to keep the Python code (ask Copilot to show it, drop it in a PY() cell) so the analysis re-runs when you refresh — or accept that you’ll re-prompt each month. Either way, you’ve made a conscious choice instead of discovering the staleness in front of an audience.
Where this fits in the finance workflow
The Python path pairs naturally with Microsoft’s June 2026 finance Skills, which added reusable, finance-specific Copilot automations for things like variance analysis and monthly reporting. Skills handle the repeatable process; Python handles the bespoke statistical visual that no template anticipated. If your work is finance-heavy, read our breakdown of the finance Skills and their charting output alongside this — together they cover the automated and the exploratory ends of the same job.
Getting it switched on
Before any of this works, Python has to be available inside Edit with Copilot, and that depends on three things lining up: a Microsoft 365 Copilot license, an update channel that has received the feature, and — in managed environments — your admin not having disabled it. If you open the Copilot pane and see the Chat/Edit switcher above the prompt box, you’re most of the way there; if Edit mode is present but Python never triggers, try naming it explicitly (“use Python for this analysis”) to confirm whether it’s disabled or just not being invoked.
If you don’t see the switcher at all, that’s almost certainly a rollout or licensing gap rather than anything you’re doing wrong. This capability rolled out in phases across the Windows, Mac, and web clients through 2026, and tenant timing varies widely. It’s worth checking your channel and license before spending an afternoon convinced the feature is broken — most of the time it simply hasn’t reached you yet.
One practical note: the Python engine runs in Microsoft’s cloud, not on your machine. That means it works the same on a lightweight laptop as on a workstation — but it also means an internet connection and the associated data-handling terms apply. For regulated or sensitive data, check what your organization’s compliance settings allow before piping financial figures through the sandbox.
The honest verdict
Python charting in Copilot is the most capable visualisation tool Excel has ever had, and also the one most likely to be misused. Use it for what native Excel can’t do — statistical shape, exotic chart types, fast exploration — and it’s genuinely excellent. Use it as a lazy default for a bar chart and you’ve made a static image that won’t update and can’t be clicked, which is strictly worse than the native chart you’d have gotten for free.
The rule is simple: native for anything interactive, live, or ordinary; Python for anything statistical, exotic, or exploratory. Get that call right and this is a superpower. Get it wrong and it’s a slower way to make a worse chart.
Frequently asked questions
Do I need to know Python to use this? No. You describe what you want in plain English and Copilot writes the code. Knowing a little Python helps you verify and reuse the output, but it isn’t required to get a chart.
Will a Python chart update when I change my data? Not automatically. Python-rendered charts are images that reflect the data at the moment the code ran. If the numbers change, the code has to rerun. Native Excel charts update on their own — pick native when live updating matters.
Why did Copilot use Python when I didn’t ask it to? Copilot can decide Python is the right tool for a task, particularly for statistical analysis or chart types Excel doesn’t offer natively. If you want a normal Excel chart, say so explicitly in the prompt.
Which chart types are only possible via Python? Boxplots, violin plots, pairplots, network graphs, ridgeline plots, and proper statistical heatmaps have no native Excel equivalent and come from the Python libraries (matplotlib, seaborn) Copilot uses.
Is there a size limit? Yes. The analysis runs in a cloud sandbox with capacity limits, and very large workbooks can time out. Narrowing the data range in your prompt is the reliable workaround.
Can I get the Python code Copilot generated?
Yes — ask Copilot to show its code. Saving it into a PY() cell makes future runs reproducible instead of depending on re-prompting.
Not sure which chart type your data even calls for? Start with Which Chart Should You Use? — then decide whether native Excel or a Python visual is the right way to build it.