> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usebrainbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Table

A `Table` object corresponds to a Brainbase worker.

## Initialize

You can either initialize a `Table` from scratch, or using an already initialized `Brainbase` object, both methods are shown below.

<CodeGroup>
  ```javascript Node.js theme={null}
  import {Brainbase, Table} from "brainbase-ai"

  // From scratch
  const table = Table(api_key="YOUR_API_KEY", table_id="TABLE_ID")

  // From Brainbase
  const row = bb.table(table_id="TABLE_ID")
  ```

  ```python Python theme={null}
  pip install brainbase-ai
  ```
</CodeGroup>

## Read

Loads the `title` and `features` of the table from the database.

<CodeGroup>
  ```javascript Node.js theme={null}
  import {Brainbase, Row} from "brainbase-ai"

  table.read()
  ```

  ```python Python theme={null}
  pip install brainbase-ai
  ```
</CodeGroup>

## Insert

The `Table` object provides an easy function to insert any file or data type natively supported by Brainbase. You can insert any of the following using the same function:

1. **Local file:** Insert any supported local file by providing the local file path
2. **URL:** Insert any remote file by providing the URL to the file. This also works for scraping the text content of non-file URLs.
3. **Dictionary:** Insert a dictionary with the keys corresponding to the keys of the features of the `Table` object.

<CodeGroup>
  ```javascript Node.js theme={null}
  import {Brainbase, Row} from "brainbase-ai"

  // Insert local file
  table.insert(file_path="/sales-call-3.mp3")

  // Insert URL
  table.insert(url="https://openai.com/secret/how-to-build-agi.pdf")

  // Insert dictionary
  table.insert(data={"name": "Sam Altman", "title": "CEO", "company": "OpenAI"})
  ```

  ```python Python theme={null}
  pip install brainbase-ai
  ```
</CodeGroup>

## Add Columns

You can add new columns to the table using the `add_columns` function.

<CodeGroup>
  ```javascript Node.js theme={null}
  import {Brainbase, Row} from "brainbase-ai"

  table.add_columns(columns=[
      {
          "key": "email",
          "name": "Email",
          "description": "Email of the contact",
          "type": "EMAIL" 
      }, {
          "key": "summary",
          "name": "Contact summary",
          "description": "A 50 words or less summary of the contact's experience in sales",
          "type": "LONG_TEXT" 
      }
  ])
  ```

  ```python Python theme={null}
  pip install brainbase-ai
  ```
</CodeGroup>

## Delete

<CodeGroup>
  ```javascript Node.js theme={null}
  import {Brainbase, Row} from "brainbase-ai"

  row.delete()
  ```

  ```python Python theme={null}
  pip install brainbase-ai
  ```
</CodeGroup>

## Run Action

You can run a worker action on a selected row using the `run` function. How to create `Action`.

<CodeGroup>
  ```javascript Node.js theme={null}
  import {Brainbase, Row} from "brainbase-ai"

  row.run(action)
  ```

  ```python Python theme={null}
  pip install brainbase-ai
  ```
</CodeGroup>
