Luau

Implementing functions in Luau

xllify lets you create high-performance Excel custom functions using Luau.

An incredibly easy language to learn, it boasts strong numerical performance and is used in Roblox and other well-known games. It therefore has millions of end users!

With xllify, your Luau code compiles to bytecode and runs directly in Excel's process at near-C speeds with full multithreaded recalculation support.

Despite being dominant for games and web server configuration, Lua(u) it is less widely used than Python in the data space. However, we encourage you to check out Luau as a starting point if your functions can be expressed as pure computations. It is simple and very fast.

What you need

Typical workflow

1

Define functions using xllify.fn(metadata, fn) calls.

2

Run the CLI to produce an XLL:

xllify awesome_lua.xll my_functions.luau
3

Load the generated XLL into Excel by double clicking on it

4

Call the custom functions from Excel like any other worksheet function.

More on building XLLs

Use the xllify CLI to build XLLs:

Examples
# Single script
xllify MyAddin.xll my_functions.luau

# Multiple scripts
xllify MyAddin.xll math.luau text.luau utils.luau

# Mix Luau and Python in a single add-in
xllify MyAddin.xll calculations.luau api_calls.py \
    --py-entrypoint api_calls \
    --py-requirements requirements.txt

Development workflow

1

Edit your .luau file

2

Close Excel

3

Rebuild XLL

xllify MyAddin.xll my_functions.luau
4

Reopen Excel

Troubleshooting

Build fails
  • Check Luau syntax with xllify-lua --load my_functions.luau

  • Verify xllify.ExcelFunction() calls are correct

  • Check file paths exist

Functions not in Excel
  • Verify function is registered with xllify.ExcelFunction()

  • Check metadata is valid

  • Rebuild XLL

Runtime errors
  • Test with xllify-lua first to debug

  • Check error messages in Excel cells

  • Check function logic

Last updated