Mito
Search
K

Import: Generated UI from any Python Function

This is a Mito Enterprise feature. Upgrade to extend your spreadsheet with additional spreadsheet functions.
The Mito spreadsheet is built to be extensible to your teams use case. Mito users or infrastructure administrators can the data analysis capabilities of their team by incorporating existing Python functions into their sheet.
Namely, any function that returns a dataframe can be exposed to a Mito user within a spreadsheet, automatically. This allows less-technical teammates to benefit from all the Python code written by the programmers in your org, without these less-technical folks needing to learn to code!

How to add a custom importer into Mito

Imagine we have a function that takes some inputs and returns a dataframe:
def get_loan_data(date: str, include_duplicates: bool) -> pd.DataFrame:
...
You can simply pass this to the mitosheet:
mitosheet.sheet(importers=[get_loan_data])
Then, this function will be accessible in the Import > Custom Import dropdown within the mitosheet. Notably, a UI will automatically be generated for this function:

Supported Types

For Mito to automatically generate the correct UI for your function, it should have Python types attached to it. The currently supported types:
Type
UI Element
str
A string input.
int
A number input. The input will be cast with the int function.
float
A number input. The input will be cast with the float function.
bool
A toggle. The input will be cast with the bool function.
unlabeled
An input that will be evaluated with the Python eval function.