The "Sheets" section in MaviBot is a tool for convenient data storage and management within the platform. You no longer need to switch between different services—all your sheets are now available in a single project.

Features:

  • Create sheets with any number of rows and columns.
  • Store and edit data without third-party tools or services.
  • Enter values, edit rows and columns, or delete them directly through the chatbot using functions.

Advantages:

  • Simplifies data management: you can enter information into a table directly from the bot.
  • Flexible and easy to use: create as many tables as you need and customize them for your business tasks.

Manage your tables without leaving Mavibot

Tables help businesses structure their data and speed up processes.

How to create sheets

To get started, go to the "Sheets" section in the required project:

Next, you will see the "Create a sheet" button. Click it to open a modal window where you need to enter the table name:

Enter a name for the table and click "Done". The new table will then be created in the project and appear in the "Sheets" section.

Sheets settings

After creating the sheet, you need to add rows and columns. To do this, find the "Go to" button on the desired table and click it:

You'll see the following settings:

  1. Function for adding columns:

а) to add lettered columns

The button adds columns labeled A to Z to the table.

b) to add columns with custom names

Clicking the button opens a modal where you can name the new column.

Enter a name and click "Done" to add the column to the table.

  1. Button for adding strokes:

  1. Sheet export

Allows you to export the sheet in CSV format with all data and values, for example, to move the sheet to another Mavibot project or to another spreadsheet service.

  1. The Import CSV feature enables you to upload data from an external service.

Other features

There is a dropdown menu that allows you to quickly browse sheets without leaving the main section.

You can also create new tables directly from the side menu.

To delete a sheet, go to the main section:

Then, find the Delete button on the card of the table you want to remove.

Warning!

Deleted tables cannot be restored.

How to enter values into the sheet

You can enter values into the sheet manually:

Or by using functions in the chatbot.

How to find a sheet ID

You will need a Sheet ID to use chatbot functions related to this table.

  1. Navigate to your table. Find the desired table in the list and click on its name to open it.
  2. Locate the Table ID in the address bar. Click on the address bar of your browser — the Table ID is the unique string of characters at the end of the URL.

  1. Example:
    In a URL like https://mavibot.ai/projects/11111/table/2
    the Table ID is 2.
  2. Copy the ID
    Select and copy this number from the address bar to use in your chatbot configuration.

How to create a new record in the sheet

new_record(table_id, data) – create a new entry in the table with the specified values.

table_id – the ID of the table

data – a dictionary containing the data to be entered. Example: {"column_name1": "value1", "column_name2": "value2"}. If a column does not exist, it will be created. Response: the ID of the new entry

Example

How to edit an existing record in the sheet

edit_record(table_id, record_id, data)

table_id – the ID of the table

record_id – the ID of the entry to be edited

data – a dictionary containing the data to be updated. Example: {"column_name1": "value3", "column_name2": "value4"}. If a column does not exist, it will NOT be created.

Response: Returns the full data of the edited entry in the format {"column_name1": "value3", "column_name2": "value4"}

Example

How to delete a sheet record by its ID

delete_record(table_id, record_id)

table_id – the ID of the table

record_id – the ID of the entry to delete

Response:

{'message': 'Deleted entries: 1'}

How to find the first record with the specified value in a sheet

find_record(table_id, value, find_in, return_from)

table_id – the ID of the table

value – the value to search for

find_in – optional. The name of the column to search in. If not specified, the search will be performed across all columns

return_from – optional. The name of the column from which to return the value

Response: If return_from is specified, the value of the specified column will be returned (if it exists in the table). If return_from is not specified or the column does not exist, the full data of the found entry will be returned: {"column_name1": "value3", "column_name2": "value4"}

Example

How to get values from the specified record

get_record_data(table_id, record_id, return_column )

table_id – the ID of the table

record_id – the ID of the entry to retrieve values from

return_column – optional. The name of the column from which to return the value

Response: If the entry is found, returns a dictionary like {"column_name1": "value1", "column_name2": "value2"}. If return_column is provided and the column exists, only the value from that column will be returned.

How to retrieve all values when searching across multiple columns

find_records_multiple_cols_list(table_id, column_data, return_col, with_index, delimiter, algorithm) – Use this function when you need to search across multiple columns at once and retrieve a list of values from a column in rows where all values are found. (This is similar to the sheet_search_in_multiple_cols_return_list function for Google Sheets.)

table_id — the ID of the table

column_data — the search query, i.e., what you want to find

return_col — the column number from which to return values

with_index — index or numbering in the list of found values (0 – numbering (1, 2, 3,…); 1 – row index; "" – list of values on new lines without indexes or numbering)

delimiter — separator between the index and the value

algorithm — search algorithm (F – exact match, K – keyword match, R – regular expression, 1–100 – similarity percentage (see details above))

Example:

table_id = 7

data = {"age": "26", "city": "New York"}

return_col = "name"

with_index = 1

delimiter = " - "

algorithm = "F"

res = find_records_multiple_cols_list(table_id, data, return_col, with_index, delimiter, algorithm)

res_list = res["list"]

If the query executes successfully, the response is a dictionary containing the status and all cells with values:

{"status":true,"rows_index":[2,3],"quantity":2,"list":"2 - John\n3 - Anna"}

status — the search result

rows_index — an array with the numbers of the found rows

quantity — the number of rows found

list — a string with all values from the selected column

If an error occurs, the response will be status: false along with an error description: {"status": false, "error": "Error or description"}

How to retrieve the first value when searching across multiple columns

find_first_record_multiple_cols_row(table_id, column_data, algorithm) – use this function when you need to search across multiple columns at once and retrieve the first matching row. (This is similar to the sheet_search_in_multiple_cols_return_row function for Google Sheets.)

table_id — the ID of the table

columns — the search query, i.e., what you want to find

algorithm — the search algorithm (F – exact match, K – keyword match, R – regular expression, 1–100 – similarity percentage (see details above))

Example:

table_id = 7

data = {"age": "26", "city": "New York"}

algorithm = "F"

res = find_first_record_multiple_cols_row(table_id, data, algorithm)

row_data = res["row_data"]

row_id = row_data["ID"]

row_name = row_data["name"]

row_age = row_data["age"]

If the query executes successfully, the response is a dictionary containing the status and all cells with values.

{"status":true,"rows_index":[2,3],"quantity":2,"row_data":{"ID":2,"name":"John","age":"26","city":"New York"},"row":2}

status — the search result

rows_index — an array with the numbers of the found rows

row_data — data from the found row

row — the number of the found row

If an error occurs, the response will be status: false along with an error description: {"status": false, "error": "Error or description"}

Cell-Level Arithmetic

Four functions allow you to modify a numeric value within a cell: addition, subtraction, multiplication, and division. Since the calculation is performed by the database itself, simultaneous requests from different clients do not overwrite one another—a safeguard that the "read-calculate-write" pattern cannot provide. These functions are ideal for managing stock levels, point balances, or counters.

Adding a Number to a Table Cell

Adds a specified number to a cell in an internal table and returns the updated value.

table_add_to_cell(table_id, record_id, column, value)
  • table_id — the ID of the table
  • record_id — the ID of the record
  • column — the name of the column
  • value — the number to be added

An empty cell is treated as zero. If the cell contains text, the function will return an error and perform no update. If the result is a whole number, it is returned without a fractional part.

Subtract a number from a table cell

table_sub_to_cell(table_id, record_id, column, value)

The parameters and behavior are the same as for table_add_to_cell.

Response:

The new value of the cell. If the "Balance" (Остаток) column contained 10, then table_sub_to_cell(1, 1, "Remaining", 3) will return:

7

Multiply a table cell by a number

table_mul_to_cell(table_id, record_id, column, value)

The parameters and behavior are the same as for table_add_to_cell.

Response:

The new value of the cell. If the "Price" (Price) column contained 12, then table_mul_to_cell(1, 2, "Price", 1.5) will return:

18

Divide a table cell by a number

table_div_to_cell(table_id, record_id, column, value)

The parameters and behavior are the same as for table_add_to_cell. Division by zero will result in an error.

Response:

The new value of the cell. If the "Price" (Price) column contained 18, then table_div_to_cell(1, 2, "Price", 2) will return:

9

Claim the first available record in a table

Find the first record that matches a given condition and mark it immediately. The search and marking operations are performed in a single query, ensuring that the same row cannot be assigned to two different clients simultaneously. This is useful for handling promo codes, appointment slots, or queues.

table_claim_record(table_id, filter_data, values)
  • table_id — The ID of the table.
  • filter_data — A JSON object in the format {"Column": "value"} used to search for an available record. The comparison is exact. An empty value indicates that the cell is "empty," meaning the record has not yet been assigned. At least one column must be specified.
  • values — A JSON object in the format {"Column": "value"} containing the data to be written into the found row. Without this, the same row could be assigned again.
    Answer:

The complete data for the claimed record, including its ID—which can subsequently be used in edit_record—is returned. For a promo code table, the call

table_claim_record(2, '{"Issued":""}', '{"Issued":"#{client_id}"}')

will return:

{"ID":1,"Code":"SALE10","Issued":"482913"}

A subsequent call will return the next available record:

{"ID":2,"Code":"SALE20","Issued":"482914"}

When no records remain, an empty string is returned; this is an expected response, not an error. You can easily check for this using a conditional statement:

if(table_claim_record(2, '{"Issued":""}', '{"Issued":"#{client_id}"}') == '', "No more promo codes available", "Your promo code has been issued")

Calculate a value based on a table column

Calculate the sum, average, count, minimum, or maximum for a column.

table_aggregate(table_id, func, column, filter_data)
  • table_id — the ID of the table.
  • func — the operation to perform: count, sum, avg, min, or max.
  • column — the name of the column. Required for all functions except count.
  • filter_data — an optional parameter. A JSON object in the format {"Column": "value"} — calculations are performed only for matching records. The comparison is exact; an empty value signifies that the cell is empty.

Empty and non-numeric cells are ignored: the average is calculated only based on populated numeric values, and the minimum is not affected (i.e., it does not default to zero) due to an empty cell. The count function, however, includes all matching records, even those with empty values.
Answer:

Number. For the "Warehouse" table:

ID Item Stock Price
1 Nut 8 25.5
2 Bolt 4 9
3 Screw 5 no

The calls will return:

table_aggregate(1, "count")                                  -> 3
table_aggregate(1, "sum", "Stock")                           -> 17
table_aggregate(1, "avg", "Stock")                           -> 5.6666666667
table_aggregate(1, "min", "Stock")                           -> 4
table_aggregate(1, "max", "Price")                           -> 25.5
table_aggregate(1, "count", "", '{"Item":"Bolt"}')           -> 1
table_aggregate(1, "sum", "Stock", '{"Item":"Nut"}')         -> 8

In the example using max on the "Price" column, the value "no" is skipped as it is non-numeric.

If no records match the condition, 0 is returned:

table_aggregate(1, "count", "", '{"Item":"Bolt"}')         -> 0