# Insert a Column in a Table

### Overview

This procedure inserts a column into a table.

### Input Concepts

| Concept          | Type   | Description                                | Default                                                             | Required                                                       |
| ---------------- | ------ | ------------------------------------------ | ------------------------------------------------------------------- | -------------------------------------------------------------- |
| `table`          | Table  | The table to insert the column into        | No default                                                          | Yes                                                            |
| `column name`    | Text   | The name of the column to insert           | No default                                                          | Yes                                                            |
| `column number`  | Number | The position of the column to be inserted. | Defaults to the end of the table, if no column number is specified. | No                                                             |
| `column values`  | List   | The values to populate the column          | No default                                                          | Either column values or a column formula need to be specified. |
| `column formula` | Text   | A formula applied to the column            | No default                                                          | Either column values or a column formula need to be specified. |
| `default value`  | Text   | A default value for the column             | No default                                                          | No                                                             |
| `other table`    | Table  | Another table to reference                 | No default                                                          | No                                                             |

### Output Concepts

| Concept | Description                         |
| ------- | ----------------------------------- |
| `table` | The table with the column inserted. |

### Examples

#### 1. Inserting a Column by Specifying the Column Values

For this example, `the table` refers to the following table, which can be generated using the `create a sample table` procedure:

| Name | Number             | Address          | City          |
| ---- | ------------------ | ---------------- | ------------- |
| john | + 1 (415) 691 9426 | 123 east street  | San Francisco |
| joe  | + 1 (415) 691 1234 | 321 west street  | San Jose      |
| jack | + 1 (415) 691 4595 | 213 north street | San Francisco |

{% tabs %}
{% tab title="Automation" %}

```
insert a column in the table where
  the column name is "Age"
  the column values are 30, 25, 35
```

{% endtab %}

{% tab title="Results" %}

| Name          | Number             | Address          | City          | Age |
| ------------- | ------------------ | ---------------- | ------------- | --- |
| john          | + 1 (415) 691 9426 | 123 east street  | San Francisco | 30  |
| joe           | + 1 (415) 691 1234 | 321 west street  | San Jose      | 25  |
| jack          | + 1 (415) 691 4595 | 213 north street | San Francisco | 35  |
| {% endtab %}  |                    |                  |               |     |
| {% endtabs %} |                    |                  |               |     |

#### 2. Inserting a Column by Specifying the Column Formula

For this example, `the table` refers to the following table, which can be generated using the `create an integer table` procedure:

| Amt | Min | Max |
| --- | --- | --- |
| 100 | 10  | 30  |
| 200 | 5   | 500 |

{% tabs %}
{% tab title="Automation" %}

```
insert a column in the table where
  the column name is "Test Col"
  the column formula is @{"type": "column_formula", "value": "conditional_column_copy(.05, Min <= 10)"}
```

{% endtab %}

{% tab title="Results" %}

| Amt           | Min | Max | Test Col |
| ------------- | --- | --- | -------- |
| 100           | 10  | 30  | 0.5      |
| 200           | 5   | 500 | 0.5      |
| {% endtab %}  |     |     |          |
| {% endtabs %} |     |     |          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/automation-areas/tables-v2/get-a-column/insert-a-column-in-a-table.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
