Skip to main content

Python for Excel

Python notebooks in Excel.

Boardflare adds a reactive Python notebook to Excel. The notebook reads workbook data and can return selected results and reusable Python functions to the worksheet.

AppSource

Two approaches to Python in Excel

Microsoft's built-in Python in Excel and Boardflare both connect Python to a workbook. The main difference is where the Python program lives.

Microsoft Python in ExcelBoardflare Python for Excel
Primary Python surfacePython formulas in worksheet cells with =PY()A reactive Python notebook alongside the workbook
Native integrationBuilt into supported Microsoft 365 versions of Excel; no third-party add-inInstalled as a Boardflare Excel add-in
Natural fitPython calculations that make sense as part of the worksheet gridMulti-step Python work that benefits from one coherent notebook
Worksheet resultsA Python formula returns its result through the cell that contains itThe notebook can publish selected results and expose reusable functions back to Excel
Programming surfaceThe workbook grid organizes the Python formulasThe notebook organizes code, Markdown, intermediate results, charts, diagnostics, and controls

Microsoft's model has clear advantages when native Microsoft integration matters and a calculation naturally belongs in a worksheet cell. Boardflare is a different approach for users who want the Python work to have a notebook as its primary programming surface.

See Microsoft's Get started with Python in Excel and PY function documentation for Microsoft's current model.

What the notebook approach changes

1. One coherent Python workspace

With =PY(), Python is authored as formulas in worksheet cells. Boardflare instead gives the Python work one notebook where transformations, models, validation, explanatory Markdown, intermediate states, charts, and controls can live together.

The notebook is reactive: cells form dependencies, and affected calculations rerun when their inputs change.

2. Excel can consume the notebook

A Microsoft Python formula returns its result through the worksheet cell that contains it. Boardflare can publish selected notebook results back to Excel and can also expose reusable Python calculations through worksheet-callable functions.

=BF.OUTPUT("forecast")
=BF.FUNCTION("discount", A1, B1)

The Python implementation can therefore remain centralized in the notebook while workbook users consume the result where they need it.

3. The notebook can become the interface

Boardflare's notebook can contain controls, tables, charts, explanations, and reactive outputs. If an analysis becomes a repeatable tool, App Mode can present the same notebook as a simplified interactive experience without requiring the analysis to be rebuilt in a separate application framework.

App Mode is optional. Many users can receive the full value of Python for Excel while working only in the notebook.

4. The Python remains portable source

The notebook is represented as Python source rather than only as code organized through workbook cells. That source can be reviewed and treated with normal software practices such as diffing, backup, and version control when a team adopts those workflows.

:::note Current source-portability boundary Boardflare saves notebook source with the workbook, but this page does not imply a complete built-in Git synchronization or one-click repository workflow. First-class import/export and source-control integrations are separate product capabilities. :::

The product model

Excel and the notebook have complementary roles. Excel can remain the place for source data, assumptions, schedules, transparent formulas, review, and delivery. The notebook is the place for Python logic that benefits from a coherent programming environment.

A minimal notebook connected to Excel

Read workbook data

import boardflare as bf

inputs = bf.inputs(
sales=bf.ref("Sales!A1:D20", headers=True),
tax_rate="Assumptions!B2",
)
inputs

Use synchronized values in downstream cells:

sales = inputs["sales"]
tax_rate = inputs["tax_rate"]

revenue = float(sales["Revenue"].sum())
after_tax_revenue = revenue * (1 - tax_rate)
summary = [
["Metric", "Value"],
["Revenue", revenue],
["After-tax revenue", after_tax_revenue],
]

Let Excel consume selected results

def discount(price, rate):
return price * (1 - rate)

publication = bf.publish(
outputs={"summary": summary},
functions={"discount": discount},
)
publication

Then use normal worksheet formulas:

=BF.OUTPUT("summary")
=BF.FUNCTION("discount", A1, B1)

:::tip Keep bridge widgets displayed Display the result of both bf.inputs() and bf.publish() in notebook cells. Their Anywidget models maintain the live connection between the notebook and spreadsheet host. :::

What this is for

Boardflare is most compelling when the Python work is large enough to benefit from being understood as a coherent analysis or program, while Excel still matters to the workflow.

Typical work includes:

  • cleaning and reshaping workbook data;
  • forecasting, regression, simulation, and statistical analysis;
  • optimization and constrained planning;
  • validation, reconciliation, controls, and exception analysis;
  • scientific and engineering analysis;
  • interactive analytical tools with controls and visualizations;
  • reusable calculations that should have one centralized Python implementation.

When another approach may be simpler

Use ordinary Excel formulas when they remain clear, transparent, and easy to maintain. A notebook does not need to replace calculations that Excel already expresses well.

A small native Python-in-Excel calculation may also be a better fit when the work is naturally bounded to a worksheet cell. External Python is usually a better fit for unrestricted file-system automation, scheduled jobs, desktop automation, large batch workflows, or packages that require capabilities unavailable in a browser runtime.

See Packages and environment for runtime boundaries.

Examples

  • Revenue Forecasting — workbook assumptions, multi-step forecasting and simulation, diagnostics, worksheet outputs, and a reusable projection function.
  • Close Reconciliation — data cleanup, accounting controls, tolerance logic, exception routing, and reconciliation output.
  • Inventory Planner — service-level replenishment planning under demand, lead-time, and budget constraints.
  • Customer Cohorts — pandas cleaning, control-total reconciliation, cohort reshaping, and segmentation.
  • Quality Control — capability statistics, confidence intervals, tests, diagnostics, and exception routing.
  • Portfolio Optimizer — explainable allocation under budget, headcount, mandatory-project, and risk constraints.
  • Curve Fitting — nonlinear estimation, parameter uncertainty, confidence bands, residual diagnostics, and live prediction.

See Examples and Templates for the full catalog and direct demo links.

Documentation

Start and build

  • Getting started — open the notebook, read workbook data, build reactive analysis, and optionally return results to Excel.
  • Designing notebooks — structure inputs, validation, model logic, controls, outputs, and maintainable reactive dependencies.
  • Workbook APIbf.ref(), bf.inputs(), bf.publish(), BF.OUTPUT(), and BF.FUNCTION().
  • AI authoring — create and revise notebook code with current context, request, and security boundaries.

Use and share

  • Sharing and trust — persistence, executable-workbook trust, App Mode, recipient requirements, and sharing checks.
  • Packages and environment — browser runtime, package compatibility, and when another Python environment is more appropriate.
  • Troubleshooting — startup, inputs, outputs, functions, networking, packages, and recovery.

Understand the runtime

  • Architecture — how Excel, the spreadsheet bridge, marimo, Pyodide, Anywidget, and worksheet formulas fit together.
  • Security and data flow — execution boundaries, cross-origin notebook isolation, AI requests, network calls, packages, and persistence.

Legacy Functions Editor

The add-in also retains the Legacy Functions Editor for previously created worksheet functions and users who explicitly enable that workflow. It is separate from notebook-published BF.FUNCTION() functions and does not define the main Python for Excel experience.

See Legacy Functions Editor for that workflow.

Next steps

  1. Try a working notebook in the browser demo.
  2. Follow Getting started in Excel.
  3. Read Designing notebooks before structuring a larger analysis.
  4. Use Sharing and trust when the workbook will be distributed to other people.