Skip to content

Columns

You'll find below all the available methods to interact with the columns of a SeaTable table.

Global structure

Here is the global structure of a column object:

{
    "key":"bjcM",
    "type":"number",
    "name":"Val",
    "editable":true,
    "width":200,
    "resizable":true,
    "draggable":true,
    "data": // (1)!
        {
            "format":"number",
            "precision":2,
            "enable_precision":false,
            "enable_fill_default_value":false,
            "enable_check_format":false,
            "decimal":"comma",
            "thousands":"no",
            "format_min_value":0,
            "format_max_value":1000
        },
    "permission_type":"",
    "permitted_users":[],
    "permitted_group":[],
    "edit_metadata_permission_type":"",
    "edit_metadata_permitted_users":[],
    "edit_metadata_permitted_group":[],
    "description":null,
    "colorbys":{},
    "editor":
        {
            "key":null,
            "ref":null,
            "props":{},
            "_owner":null
        },
    "formatter":
        {
            "key":null,
            "ref":null,
            "props":{},
            "_owner":null
        }
}
  1. See below for a presentation of data object keys depending on the column type

Columns particularities

  • Unless other elements, columns don't have an _id, but a key
  • Link-type columns also have a link id that should not be mistaken with the column key. This value is present in the data object (see below)

Column data

The data object keys will depend on the column type and will allow you to define the specific column parameters. Here is a list of the different data keys depending on the column type:

text, email, long-text, image, file, url, creator, ctime, last-modifier, mtime

empty

link
{
    "display_column_key":"qqXZ",
    "table_id":"0000",
    "other_table_id":"XE5U",
    "is_internal_link":true,
    "is_multiple":true,
    "only_adding_new_record":false,
    "is_row_from_view":false,
    "other_view_id":"",
    "link_id":"OSD1",
    "array_type":"text",
    "array_data":null,
    "result_type":"array"
}
number
{
    "format":"custom_currency",
    "precision":2,
    "enable_precision":true,
    "enable_fill_default_value":false,
    "decimal":"comma",
    "thousands":"no",
    "currency_symbol_position":"after",
    "currency_symbol":"p"
}
date
{
    "format":"M/D/YYYY HH:mm"
}
duration
{
    "format":"duration",
    "duration_format":"h:mm"
}
single select, multiple select
{
    "options":
        [
            {
                "name":"Male",
                "id":"783482",
                "color":"#46A1FD",
                "textColor":"#FFFFFF",
                "borderColor":"#3C8FE4"
            },
            {
                "name":"Female",
                "id":"330935",
                "color":"#DC82D2",
                "textColor":"#FFFFFF",
                "borderColor":"#D166C5"
            },
            {
                "name":"Non-binary",
                "id":"147140",
                "color":"#ADDF84",
                "textColor":"#FFFFFF",
                "borderColor":"#9CCF72"
            }
        ],
        "cascade_column_key":"Qvkt",
        "cascade_settings":
            {
                "147140":["783482"],
                "330935":["330935"],
                "783482":["783482"]
            }
}
checkbox
{
    "default_value":false,
    "enable_fill_default_value":false
}
rate
{
    "rate_max_number":5,
    "rate_style_color":"#FF8000",
    "default_value":"",
    "enable_fill_default_value":false
}
formula
{
    "formula":"left({Email},search(\"@\",{Email},1)-1)",
    "operated_columns":["JfP2"],
    "result_type":"string",
    "enable_precision":true,
    "precision":1,
    "thousands":"no"
}
link-formula
{
    "formula":"findmax",
    "result_type":"array",
    "operated_columns":["TaXD"],
    "conditions":[],
    "link_column_key":"TaXD",
    "include_condition":false,
    "condition_conjunction":"And",
    "column_key_in_linked_record":"0000",
    "column_key_for_comparison":"RSjx",
    "level2_linked_table_column_key":null,
    "array_type":"auto-number",
    "array_data":null
}
geolocation
{
    "geo_format":"lng_lat"
}
auto-number
{
    "format":"YYYYMMDD-00",
    "max_used_auto_number":33,
    "digits":2,
    "prefix_type":"date",
    "prefix":"20250909"
}
button
{
    "button_type":"copy_row_to_another_table",
    "button_name":"Copy to Table2",
    "button_color":"#FFFCB5",
    "table_id":"0000"
}

Accessing a particular data object value

This rather long list is not exhaustive, however. If you need to access a specific data value, consult the SeaTable API Reference or create the corresponding column to display the content of its data object.

ColumnTypes constants

ColumnTypes

When you want to insert/add a column or change a column type, you will need to use these ColumnTypes.

from seatable_api.constants import ColumnTypes # (1)!

ColumnTypes.NUMBER              # number
ColumnTypes.TEXT                # text
ColumnTypes.LONG_TEXT           # long text
ColumnTypes.CHECKBOX            # checkbox
ColumnTypes.DATE                # date & time
ColumnTypes.SINGLE_SELECT       # single select
ColumnTypes.MULTIPLE_SELECT     # multiple select
ColumnTypes.IMAGE               # image
ColumnTypes.FILE                # file
ColumnTypes.COLLABORATOR        # collaborator
ColumnTypes.LINK                # link to other records
ColumnTypes.FORMULA             # formula
ColumnTypes.CREATOR             # creator
ColumnTypes.CTIME               # create time
ColumnTypes.LAST_MODIFIER       # last modifier
ColumnTypes.MTIME               # modify time
ColumnTypes.GEOLOCATION         # geolocation
ColumnTypes.AUTO_NUMBER         # auto munber
ColumnTypes.URL                 # URL
  1. Don't forget this particular import to use ColumnTypes!

Get Column(s)

get_column_by_name

Get the column of the table table_name, given the column name column_name.

base.get_column_by_name(table_name, column_name)

Output Single column dict (None if no column named column_name exists, throws an error if no table named table_name exists)

Example

from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
column = base.get_column_by_name('Table1', 'Name')
print(column)

list_columns

Get the columns of a table (specified by its name table_name), optionally from a specific view (specified by its name view_name).

base.list_columns(table_name, view_name=None)

Output List of column dicts (throws an error if no table named table_name exists or if no view named view_name exists)

Example

from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
columns = base.list_columns('Table1', 'Default View')
print(columns)

get_columns_by_type

Get all the columns of a specific column_type in the table table_name. See the ColumnTypes constants above or the API Reference for more information about supported column types.

base.get_columns_by_type(table_name, column_type)

Output List of column dicts (eventually empty; throws an error if no table named table_name exists or if column_type is not a valid ColumnTypes member)

Example

from seatable_api import Base, context
from seatable_api.constants import ColumnTypes

base = Base(context.api_token, context.server_url)
base.auth()
columns = base.get_columns_by_type('Table1', ColumnTypes.TEXT)
print(columns)

Insert column

insert_column

Insert (inside the table) or append (at the end of the table) a column named column_name to the table table_name.

base.insert_column(table_name, column_name, column_type, column_key=None, column_data=None) # (1)!
  1. column_type: See the ColumnTypes constants above or the API Reference for more information about supported column types

    column_key (optional): argument specifying the key of the anchor column for the insertion (the newly created column will appear just to the right of the anchor column)

    column_data (optional): For some particular ColumnTypes, specific column data may be provided in the column_data dict. See the column data above for more information.

Output Single column dict (throws an error if no table named table_name exists, if a column named column_name already exists or if column_type is not a valid ColumnTypes member)

Example

from seatable_api.constants import ColumnTypes
from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.insert_column('Table1', 'New long text column', ColumnTypes.LONG_TEXT)
from seatable_api.constants import ColumnTypes
from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.insert_column('Table1', 'Link', ColumnTypes.LINK, column_data={
    'table':'Table1',
    'other_table':'Test_User'
})

Rename column

rename_column

Rename the column in the table table_name whose key is column_key with the new name new_column_name. Please ensure that you choose a new_column_name that doesn't already exists in your table table_name.

base.rename_column(table_name, column_key, new_column_name)

Output Single column dict (throws an error if no table named table_name exists or if no column with the key column_key exists)

Example

from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.rename_column('Table1', '0000', 'new column name') # (1)!
  1. 0000 is always the key of the first column in each table
from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
column_to_rename = base.get_column_by_name('Table1', 'My Column')
base.rename_column('Table1', column_to_rename['key'], 'new column name') # (1)!
  1. Accessing the key value of a column you just retrieved (for example with base.get_column_by_name), you don't have to explicitly know its column_key

(Un)freeze column

(Un)freeze_column

Freeze (fix) or unfreeze the column of table table_name whose key is column_key.

(Un)freezing a group of columns

Please note that this method acts on a single column: to freeze the n-first left columns, please run it for each column!

base.freeze_column(table_name, column_key, frozen) # (1)!
  1. column_key: the key of the column you want to (un)freeze

    frozen: True to freeze, False to unfreeze

Output Single column dict (throws an error if no table named table_name exists or if no column with the key column_key exists)

Example

from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.freeze_column('Table1', '0000', True)

Move column

move_column

Move the column of table table_name whose key is column_key.

base.move_column(table_name, column_key, target_column_key) # (1)!
  1. column_key: the key of the column you want to move

    target_column_key: the key of the anchor column for the move (the column whose key is column_key will be moved just to the right of the anchor column)

Output Single column dict (throws an error if no table named table_name exists or if no column with the key column_key or target_column_key exists)

Example

from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.move_column('Table1', 'loPx', '0000') # (1)!
  1. In this example, the column with the key loPx will be moved to the right of the column 0000

Modify column type

modify_column_type

Change the column type of an existing column of table table_name whose key is column_key.

Don't change column type to ColumnTypes.LINK

This method doesn't allow to pass column data for the moment. Trying to change the column type to ColumnTypes.LINK will then lead to a "broken" column (you won't be able to edit the column's settings) as column data is mandatory for link-type columns.

base.modify_column_type(table_name, column_key, new_column_type) # (1)!
  1. column_key (optional): the key of the column you want to modify the type

    new_column_type: See the ColumnTypes constants above or the API Reference for more information about supported column types

Output Single column dict (throws an error if no table named table_name exists, if no column with the key column_key exists or if new_column_type is not a valid ColumnTypes member)

Example

from seatable_api.constants import ColumnTypes
from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.modify_column_type('Table1', 'nePI', ColumnTypes.CHECKBOX)

Delete column

delete_column

Delete the column whose key is column_key in the table table_name. You cannot delete the first column as explained here.

base.delete_column(table_name, column_key)

Output Dict containing a single success key with the result of the operation (throws an error if no table named table_name exists, if no column with the key column_key exists or if you try to delete the first column)

Example

from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.delete_column('Table1', 'bsKL')

Single- and/or multiple-select columns specific methods

Add column options

add_column_options

Used by both "single select" or "multiple select"-type columns to add new options to the column column_name of the table table_name.

base.add_column_options(table_name, column_name, options) # (1)!
  1. options: list of option dict containing the following keys:

    • name: displayed text of the option

    • color: background color of the option (hex code)

    • textColor: text color of the option (hex code)

Output Dict containing a single success key with the result of the operation (throws an error if no table named table_name exists, if no column named column_name exists or if options is invalid)

Example

from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.add_column_options('Table1', 'My choices', [
    {"name": "ddd", "color": "#aaa", "textColor": "#000000"},
    {"name": "eee", "color": "#aaa", "textColor": "#000000"},
    {"name": "fff", "color": "#aaa", "textColor": "#000000"},
])

Add column cascade settings

add_column_cascade_settings

Used by "single select"-type column, to condition the available options (see cascading in the user manual or in the API Reference) of a child column child_column based on the options of a parent column parent_column.

base.add_column_cascade_settings(table_name, child_column, parent_column, cascade_settings) # (1)!
  1. child_column: name of the column you want to condition the available options for

    parent_column: name of the parent column whose options will be used to condition the available options of the child column

    cascade_settings: cascade dict using the following structure:

    • each key is the name of an option from the parent column

    • each corresponding value is a list of the names of every allowed options from the child column

Output Dict containing a single success key with the result of the operation (throws an error if no table named table_name exists, if no column named child_column or parent_column exists or if cascade_settings is invalid)

Example

from seatable_api import Base, context

base = Base(context.api_token, context.server_url)
base.auth()
base.add_column_cascade_settings("Table1", "Child", "Parent", {
    "aaa": ["aaa-1", "aaa-2"], # (1)!
    "bbb": ["bbb-1", "bbb-2"],
    "ccc": ["ccc-1", "ccc-2"]
})
  1. If aaa is selected in the parent column, the available options for the child column will be aaa-1 and aaa-2