Skip to content

Methods

This is a list of all available objects and methods in SeaTable you can use in the plugin development.

For a more detailed description of the used parameters, refer to the data model at the SeaTable API Reference.

Common

Base represents a table in SeaTable. The base object provide a way to read, manipulate and output data in/from your base. The following methods are available.

Users

getRelatedUsers

Get other users associated with the current base (collaborators of the table, the shared person of the table, etc.)

dtable.getRelatedUsers()

Example

const collaborators = dtable.getRelatedUsers();
getCollaboratorsName

Get a list of names of collaborators

dtable.getCollaboratorsName(collaborators, value)
Arguments

  • collaborators: collaborator list in this base
  • value: email list of collaborators

Example

const collaborators = dtable.getRelatedUsers();
const value = ['abc@seafile.com', 'shun@seafile.com'];
const name = dtable.getCollaboratorsName(collaborators, value); // 'abc, shun'

Views

getViewRowsColor

Get the color attributes of the row data in the view

dtable.getViewRowsColor(rows, view, table)

Arguments

  • rows: the rows of the color attribute
  • view: view object
  • table: table object

Example

const tableName = 'tableName';
const viewName = 'viewName';
const table = dtable.getTableByName(tableName);
const view = dtable.getViewByName(table, viewName);
const rows = dtable.getViewRows(view, table);
const rowsColor = dtable.getViewRowsColor(rows, view, table);

Output

getTableFormulaResults

Get the data in the calculation formula column of the table

dtable.getTableFormulaResults(table, rows)

Arguments

  • table: table object
  • rows: row data of the relevant data of the calculation formula column

Example

const tableName = 'tableName';
const viewName = 'viewName';
const table = dtable.getTableByName(tableName);
const view = dtable.getViewByName(table, viewName);
const rows = dtable.getViewRows(view, table);
const formulaResult = dtable.getTableFormulaResults(table, rows);
getLinkCellValue

Get a list of names of collaborators


Example


getLinkDisplayString

Get a list of names of collaborators


Example


getLinkDisplayString

Get a list of names of collaborators


Example


getNumberDisplayString

Get a list of names of collaborators


Example


getGeolocationDisplayString

Get a list of names of collaborators


Example


getDurationDisplayString

Get a list of names of collaborators


Example


getDateDisplayString

Get a list of names of collaborators


Example


Tables

addTable

Get a list of names of collaborators


Example


deleteTable

Get a list of names of collaborators


Example


renameTable

Get a list of names of collaborators


Example


getTables

Get a list of names of collaborators


Example


getActiveTable

Get a list of names of collaborators


Example


getTableByName

Get a list of names of collaborators


Example


getTableById

Get a list of names of collaborators


Example


importDataIntoNewTable

Get a list of names of collaborators


Example


Views

addView

Get a list of names of collaborators


Example


deleteView

Get a list of names of collaborators


Example


renameView

Get a list of names of collaborators


Example


getViews

Get a list of names of collaborators


Example


getNonArchiveViews

Get a list of names of collaborators


Example


getActiveView

Get a list of names of collaborators


Example


getViewByName

Get a list of names of collaborators


Example


getViewById

Get a list of names of collaborators


Example


isDefaultView

Get a list of names of collaborators


Example


isGroupView

Get a list of names of collaborators


Example


isFilterView

Get a list of names of collaborators


Example


Columns

getColumns

Get a list of names of collaborators


Example


getShownColumns

Get a list of names of collaborators


Example


getColumnsByType

Get a list of names of collaborators


Example


getColumnByName

Get a list of names of collaborators


Example


getColumnByKey

Get a list of names of collaborators


Example


modifyColumnData

Get a list of names of collaborators


Example


Rows

sqlQuery

Use sql statement to query a dtable

dtable.sqlQuery(sql)

Arguments

  • sql: SQL statement to be executed

Note: By default, up to 100 results are returned. If you need more results, please add the limit parameter in the sql statement

Possible errors include

  • ValueError: sql can not be empty
  • ConnectionError: network error
  • Exception: no such table
  • Exception: no such column
  • Exception: columns in group by should match columns in select

Example

dtable.sqlQuery('select name, price, year from Bill')
[
    {'_id': 'PzBiZklNTGiGJS-4c0_VLw', 'name': 'Bob', 'price': 300, 'year': 2019},
    {'_id': 'Ep7odyv1QC2vDQR2raMvSA', 'name': 'Bob', 'price': 300, 'year': 2021},
    {'_id': 'f1x3X_8uTtSDUe9D60VlYQ', 'name': 'Tom', 'price': 100, 'year': 2019},
    {'_id': 'NxeaB5pDRFKOItUs_Ugxug', 'name': 'Tom', 'price': 100, 'year': 2020},
    {'_id': 'W0BrjGQpSES9nfSytvXgMA', 'name': 'Tom', 'price': 200, 'year': 2021},
    {'_id': 'EvwCWtX3RmKYKHQO9w2kLg', 'name': 'Jane', 'price': 200, 'year': 2020},
    {'_id': 'BTiIGSTgR06UhPLhejFctA', 'name': 'Jane', 'price': 200, 'year': 2021}
]

WHERE

dtable.sqlQuery('select name, price from Bill where year = 2021 ')
[
    {'_id': 'Ep7odyv1QC2vDQR2raMvSA', 'name': 'Bob', 'price': 300},
    {'_id': 'W0BrjGQpSES9nfSytvXgMA', 'name': 'Tom', 'price': 200},
    {'_id': 'BTiIGSTgR06UhPLhejFctA', 'name': 'Jane', 'price': 200}
]

ORDER BY

dtable.sqlQuery('select name, price, year from Bill order by year')
[
    {'_id': 'PzBiZklNTGiGJS-4c0_VLw', 'name': 'Bob', 'price': 300, 'year': 2019},
    {'_id': 'f1x3X_8uTtSDUe9D60VlYQ', 'name': 'Tom', 'price': 100, 'year': 2019},
    {'_id': 'NxeaB5pDRFKOItUs_Ugxug', 'name': 'Tom', 'price': 100, 'year': 2020},
    {'_id': 'EvwCWtX3RmKYKHQO9w2kLg', 'name': 'Jane', 'price': 200, 'year': 2020},
    {'_id': 'Ep7odyv1QC2vDQR2raMvSA', 'name': 'Bob', 'price': 300, 'year': 2021},
    {'_id': 'W0BrjGQpSES9nfSytvXgMA', 'name': 'Tom', 'price': 200, 'year': 2021},
    {'_id': 'BTiIGSTgR06UhPLhejFctA', 'name': 'Jane', 'price': 200, 'year': 2021}
]

GROUP BY

dtable.sqlQuery('select name, sum(price) from Bill group by name')
[
    {'SUM(price)': 600, 'name': 'Bob'},
    {'SUM(price)': 400, 'name': 'Tom'},
    {'SUM(price)': 400, 'name': 'Jane'}
]

DISTINCT

dtable.sqlQuery('select distinct name from Bill')
[
    {'_id': 'PzBiZklNTGiGJS-4c0_VLw', 'name': 'Bob'},
    {'_id': 'f1x3X_8uTtSDUe9D60VlYQ', 'name': 'Tom'},
    {'_id': 'EvwCWtX3RmKYKHQO9w2kLg', 'name': 'Jane'}
]
appendRow

Get a list of names of collaborators


Example


deleteRowById

Get a list of names of collaborators


Example


deleteRowsByIds

Get a list of names of collaborators


Example


modifyRow

Get a list of names of collaborators


Example


forEachRow

Get a list of names of collaborators


Example


getTableLinkRows

Get a list of names of collaborators


Example


getViewRows

Get a list of names of collaborators


Example


getGroupRows

Get a list of names of collaborators


Example


getInsertedRowInitData

Get a list of names of collaborators


Example


getRowsByID

Get a list of names of collaborators


Example


getRowById

Get a list of names of collaborators


Example


moveGroupRows

Get a list of names of collaborators


Example


Plugins

getPluginSettings

Get a list of names of collaborators


Example


updatePluginSettings

Get a list of names of collaborators


Example


deletePluginSettings

Get a list of names of collaborators


Example


Constants

ColumnTypes

Get a list of names of collaborators


Example


Column icon configs

Get a list of names of collaborators


Example


Column options

Get a list of names of collaborators


Example


Formula result type

Get a list of names of collaborators


Example


Select option colors

Get a list of names of collaborators


Example


Table permission type

Get a list of names of collaborators


Example