Skip to content

Scripting Features

These features are only available when running JavaScript scripts inside SeaTable. They provide access to the browser context, output functions, and utility helpers.

Context

The base.context object provides information about the current user interaction.

currentTable

The currently selected table name.

const tableName = base.context.currentTable;

currentRow

The current row when the script is triggered via a button. Contains the full row data.

const row = base.context.currentRow;
output.text(row['Name']);

Warning

currentRow is only available when the script is executed via a button column. When running manually, currentRow is undefined.

Output

The output object displays results in the script output panel.

output.text

Display text or any variable in the output panel. Accepts strings, numbers, objects, and arrays.

output.text(anything);

Example

output.text('Hello World');
output.text(42);
output.text(row);

output.markdown

Display markdown-formatted content in the output panel.

output.markdown(markdownString);

Example

output.markdown('# Title\n\nSome **bold** text.');

Utilities

The base.utils object provides helper functions.

formatDate

Format a date object to YYYY-MM-DD.

base.utils.formatDate(date);

Example

const today = base.utils.formatDate(new Date());
// Returns: "2026-03-18"

formatDateWithMinutes

Format a date object to YYYY-MM-DD HH:mm.

base.utils.formatDateWithMinutes(date);

Example

const now = base.utils.formatDateWithMinutes(new Date());
// Returns: "2026-03-18 14:30"

lookupAndCopy

Look up a value in another table and copy it. Similar to VLOOKUP in spreadsheets.

base.utils.lookupAndCopy(targetTable, targetColumn, targetColumnToSearch, sourceTable, sourceColumn, sourceColumnToSearch);

Example

// Copy "Email" from Contacts table where the Name matches
base.utils.lookupAndCopy(
    'Orders', 'Customer Email', 'Customer Name',
    'Contacts', 'Email', 'Name'
);