Skip to content

ExcelAddin

Represents an Excel add-in deployment on Datatailr.

An Excel add-in exposes Python functions as Excel worksheet functions, allowing users to call server-side computations directly from Excel spreadsheets.

Example
from datatailr import ExcelAddin
from datatailr.excel import Addin

addin_def = Addin("Options Pricer", "Option pricing functions")

@addin_def.expose(description="Black-Scholes price")
def price_option(spot, strike, vol, rate, expiry):
    ...

def __excel_main__(port=8080, ws_port=8000):
    addin_def.run(port, ws_port)

addin = ExcelAddin(
    name="Options Pricer",
    entrypoint=__excel_main__,
    python_requirements=["numpy", "scipy"],
)
addin.run()

__init__(name, entrypoint, environment=Environment.DEV, image=None, run_as=None, resources=Resources(), acl=None, python_version='3.12', python_requirements='', build_script_pre='', build_script_post='', env_vars=None, update_existing=False, app_section='')

Initialize an Excel add-in deployment.

Parameters:

Name Type Description Default
name str

Display name for the add-in.

required
entrypoint Callable

The callable (function) that starts the add-in server.

required
environment Optional[Environment]

Target environment for the deployment.

DEV
image Optional[Image]

Pre-configured container Image.

None
run_as Optional[Union[str, User]]

User or username to run the add-in as.

None
resources Resources

CPU and memory resources for the container.

Resources()
acl Optional[ACL]

Access control list.

None
python_version str

Python version for the container image.

'3.12'
python_requirements str | List[str]

Python dependencies (see Image).

''
build_script_pre str

Dockerfile commands to run before installing requirements.

''
build_script_post str

Dockerfile commands to run after installing requirements.

''
env_vars Optional[Dict[str, str | int | float | bool]]

Environment variables passed to the running container.

None
update_existing bool

If True, update an existing job definition.

False
app_section str

The section to which the app belongs. If not provided, the app will be assigned to the default section. This affects the app launcher page.

''