Excel Function Reference
Reference for BlazeXL custom functions in Excel, including how to use them for exploration and how to transition logic into governed production workflows.
Excel Function Reference
BlazeXL exposes two core custom functions in Excel:
PYfor drafting, executing, and calling logicDATAfor turning ranges into cloud-resident data handles or resolving shared objects
These functions are most useful when treated as part of a broader workflow:
- use Excel for authoring and interaction
- use BlazeXL for execution and governance
- use published Blaze Blocks for production logic
Recommended Usage Model
BlazeXL supports both exploratory work and governed execution inside Excel.
Exploratory Mode
Use PY and DATA when you want to:
- test a calculation
- prototype a transformation
- explore a model with spreadsheet inputs
- refine logic before publishing it
Governed Mode
Use published Blaze Blocks when the logic is meant to support production decisions.
That is the right model for:
- pricing and forecasting
- approval logic
- risk and policy checks
- finance and operations workflows
In governed mode, Excel stays the surface, while BlazeXL enforces versioning, permissions, execution controls, and auditability underneath.
PY() is used in both modes. The difference is what PY() is allowed to execute:
- in exploratory mode,
PY()can draft and run ad hoc logic - in strict mode,
PY()can only call approved Block functions declared for the workbook
Understanding Handles
When you execute code or load data in BlazeXL, results are returned as Handles — lightweight references to high-performance objects living in the BlazeXL Cloud. This keeps Excel responsive even with large datasets.
| Prefix | Type | Description |
|---|---|---|
|T| | Table / Series | DataFrames, Series, or Arrow Tables. |
|F| | Function | Reusable Python functions, lambdas, or partially applied (curried) handles. |
|P| | Plotly | Interactive 3D, scatter, and distribution visualizations. |
|M| | Static Plot | Matplotlib or Seaborn images (PNG/SVG). |
|D| | Dictionary | Complex nested objects, ML model parameters, or configuration. |
|S| | String | Richly formatted reports, tables, or multi-line text outputs. |
|O| | Shared Object | Reference to a named object in your organization's shared registry. |
Magic Feature: Click-to-Show
Any cell containing a BlazeXL handle is interactive.
Simply select the cell in Excel, and the BlazeXL Web Dashboard (if open) will automatically detect the handle and provide a rich visualization of the data, plot, or Python source code. This allows you to "peek" into cloud-resident data without pulling massive amounts of data into your workbook grid.
Core Functions
=BLAZEXL.PY(code, [arg1], [arg2], ...)
The unified execution function.
PY can be used to:
- execute Python expressions
- define reusable functions
- call function handles
- call loaded or published Block functions
- work with handles returned from earlier formulas
For production workflows, use PY() to call reviewed Block functions rather than relying on ad hoc inline code.
code: Python code, a function handle (\|F\|...\|), a lambda string, or a module function reference (e.g.,math_utils.add).arg1...argN(Optional): Values from cells or handles. Available in Python asargs['arg1'],args['arg2'], etc.
How a range argument arrives
| Range | In Python |
|---|---|
| One cell | The value |
| One row or one column | A list |
| A block of cells (2 × 2 or larger) | A pandas DataFrame. Every row is data, and the columns are 0, 1, 2, …, as pd.read_excel(header=None) gives. |
A range passed straight to PY has no header row. To use the first row as column names, pass the range through
DATA() first: =BLAZEXL.PY(code, BLAZEXL.DATA(A1:C50)).
Workbooks that used BlazeXL before this change keep their old behaviour: the first row of a block becomes the
header. That is recorded in the workbook itself, so the file behaves the same on every machine. To move such a
workbook to the new behaviour, run BlazeXL.rangeSemantics.set(2) from the add-in's developer console and
recalculate.
Best used for
- drafting and validating logic in Excel
- turning a repeated formula pattern into a reusable function
- calling governed Block functions in production workbooks
- testing a Block function before standardizing a workbook around it
Examples:
| Formula | Result | Description |
|---|---|---|
=BLAZEXL.PY("1 + 1") | 2 | Evaluate an expression |
=BLAZEXL.PY("import numpy as np; return np.mean(args['arg1'])", A1:A10) | 42.5 | Compute with cell data |
=BLAZEXL.PY("def calc(x): return x * 1.15") | |F|handle| | Define a reusable function |
=BLAZEXL.PY(B5, 100) | 115 | Call a function handle (B5 = |F|calc|) |
=BLAZEXL.PY("lambda x, y: x + y", 10, 20) | 30 | Inline lambda with args |
=BLAZEXL.PY("math_utils.add", 3, 5) | 8 | Call a loaded Block function |
=BLAZEXL.PY("analyze(data)", BLAZEXL.DATA("sales")) | |T|result| | Pass a shared object as an arg |
Exploratory to governed example
# Explore logic in Excel
=BLAZEXL.PY("def discount(price, pct): return price * (1 - pct)")
# Validate behavior
=BLAZEXL.PY(A1, 100, 0.2)
# Publish the reviewed logic as a Blaze Block
# Then execute the approved version in governed workbooks
=BLAZEXL.PY("pricing.discount", 100, 0.2)
In strict mode, only the final form is allowed.
Power Feature: Automatic Currying
If you call a function with fewer arguments than it expects, BlazeXL returns a new Function Handle with the provided arguments pre-filled (partial application).
- Define:
=BLAZEXL.PY("def add(a, b): return a + b")→\|F\|add\| - Curry:
=BLAZEXL.PY(A1, 10)→\|F\|partial\|(only needsb) - Execute:
=BLAZEXL.PY(A2, 5)→15
Shared Object Args
You can pass shared objects directly as arguments to PY using the \|O\|name\| prefix. The gateway automatically resolves them to their underlying data before execution.
=BLAZEXL.PY("df.describe()", "\|O\|company_sales\|") — resolves company_sales from your org's shared registry and passes it as arg1.
=BLAZEXL.DATA(data, [hasHeader], [dataType])
The unified data function. Creates DataFrames from ranges or resolves shared objects by name.
Use DATA when you want Excel ranges to participate in BlazeXL execution without moving large datasets directly into workbook formulas.
Mode 1: Range → DataFrame/Series
data: An Excel range (e.g.,A1:C50).hasHeader(Optional): Defaults toTRUE. Uses first row as column names.dataType(Optional):"dataframe"(default),"series", or"auto"(detects from shape).
| Formula | Result | Description |
|---|---|---|
=BLAZEXL.DATA(A1:C50) | |T|handle| | DataFrame with headers |
=BLAZEXL.DATA(A1:C50, FALSE) | |T|handle| | DataFrame, no headers |
=BLAZEXL.DATA(A1:A10) | |T|handle| | Auto-detected as Series |
=BLAZEXL.DATA(A1:C50, TRUE, "series") | |T|handle| | Explicit Series |
Mode 2: Shared Object Resolution
When you pass a single cell containing a string, DATA resolves it from your organization's shared object registry:
| Formula | Result | Description |
|---|---|---|
=BLAZEXL.DATA("company_sales") | |T|handle| | Resolve by name |
=BLAZEXL.DATA(A1) where A1 = |O|sales| | |T|handle| | Resolve via |O| prefix |
=BLAZEXL.DATA(A1) where A1 = |T|handle| | |T|handle| | Pass-through (no-op) |
Pro Tip: Native Python Compatibility
The handle returned by DATA() represents a fully qualified Pandas DataFrame or Series in the compute engine. You can pass it directly into any Python function and it will work without conversion.
=BLAZEXL.PY("df.groupby('region').sum()", BLAZEXL.DATA(A1:D50))
Shared Objects
Shared Objects let you publish data to your organization or team so that colleagues can reference it by name — without needing access to the original spreadsheet.
Publishing (via the Dashboard):
- Click "Share" on any Table handle in the Dashboard workspace.
- Give it a name (e.g.,
q4_sales) and choose visibility (teamororg).
Consuming (in any Excel workbook):
=BLAZEXL.DATA("q4_sales")
This resolves the shared object through the governed access-control system, ensuring only authorized users in the correct team/org can access it.
Best Practices
-
Use
PYin both modes, but change what it is allowed to execute. In exploratory workflows it can draft logic. In governed workflows it should invoke published Block functions only. -
Pass
DATAhandles directly intoPYfor clean spreadsheet-to-runtime pipelines.=BLAZEXL.PY("df.describe()", BLAZEXL.DATA(A1:D50)) -
Use shared objects when teams need governed access to common datasets.
=BLAZEXL.PY("forecast(sales)", BLAZEXL.DATA("company_sales")) -
Call Block functions through
PYwhen logic is approved and reused across systems.=BLAZEXL.PY("finance.npv", 0.08, BLAZEXL.DATA(B2:B20)) -
Use strict mode in governed workbooks. In strict mode,
PY()cannot define arbitrary new logic and workbooks rely on declared, approved Block dependencies. -
Let handles stay in the cloud. BlazeXL automatically manages large object lifecycles so Excel stays responsive while compute and storage remain off-grid.