Tables¶
Global structure¶
Here is the global structure of a table object:
{
"_id": "IfcB",
"name": "New table",
"is_header_locked": false,
"summary_configs": {},
"columns": [ // (1)!
{
"key": "0000",
"type": "number",
"name": "First column",
"editable": true,
"width": 200,
"resizable": true,
"draggable": true,
"data": null,
"permission_type": "",
"permitted_users": []
},
{
"key": "2w6F",
"type": "text",
"name": "second column",
"editable": true,
"width": 200,
"resizable": true,
"draggable": true,
"data": null,
"permission_type": "",
"permitted_users": []
},
{
"key": "3aAf",
"type": "date",
"name": "third column",
"editable": true,
"width": 200,
"resizable": true,
"draggable": true,
"data": null,
"permission_type": "",
"permitted_users": []
}
],
"rows": [], // (2)!
"views": [ // (3)!
{
"_id": "0000",
"name": "Default View",
"type": "table",
"is_locked": false,
"filter_conjunction": "And",
"filters": [],
"sorts": [],
"groupbys": [],
"group_rows": [],
"groups": [],
"colorbys": {},
"hidden_columns": [],
"rows": [],
"formula_rows": {},
"link_rows": {},
"summaries": {},
"colors": {}
}
],
"id_row_map": {}
}
-
Array of existing columns
-
Array of existing rows
-
Array of existing views
Please refer to the SeaTable API Reference for a more detailed presentation.{ "_id": "0000", "name": "Default View", "type": "table", "is_locked": false, "rows": [], "formula_rows": {}, "summaries": [], "filter_conjunction": "And", "sorts": [], "filters": [], "hidden_columns": [], "groupbys": [], "group_rows": [], "groups": [] }
Get Table(s)¶
getActiveTable
Get the currently selected table. Only available in SeaTable scripts.
Output Single table objectExample
getTables
Get all tables of the current base.
Output Array of table objectsExample
getTableByName
Get a table object by its name.
Output Single table object (undefined if table doesn't exist)
Example
Add Table¶
addTable
Add a new table to this base. Ensure the name doesn't already exist.
The lang and columns parameters are optional.
Example
Rename Table¶
renameTable
Rename an existing table.
Example
Delete Table¶
deleteTable
Delete a table from the base. The table can be restored from the logs. Deleting the last table is not possible.
Example