# Columns

### Overview

This procedure inserts a column into an existing Excel worksheet at a specified column number. The existing column at that position, along with any columns to its right, is shifted one position to the right. This is useful in automation workflows where new data fields need to be dynamically added without overwriting existing content.

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><code>insert a column into the worksheet</code></summary>

#### What does it do?

Begins column insertion into the current worksheet.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — A reference to **the worksheet** must be defined in the automation.

</details>

<details>

<summary><code>the column name is "column-header"</code></summary>

#### What does it do?

Specifies the header name for the new column.

#### Where does it go?

Indented under `insert a column into the worksheet where`.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — Replace **column-header** with the desired column header name.

#### Example

```
the column name is "Total"
```

</details>

<details>

<summary><code>the column number is n</code></summary>

#### What does it do?

Specifies where to insert the new column.

#### Where does it go?

Indented under `insert a column into the worksheet where`.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — Replace **n** with a column number (1-based). Existing columns will be shifted right.

#### Example

```
the column number is 3
```

</details>

<details>

<summary><code>the column values are x, y, z</code></summary>

#### What does it do?

Specifies the data to insert into the new column.

#### Where does it go?

Indented under `insert a column into the worksheet where`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **x, y, z** with a list of values for the column cells. If not specified, the column will be empty.

#### Example

```
the values are 100, 200, 300
```

</details>

### Examples

#### 1. Insert Empty Column

Inserts an empty column with a header at position 2.

```
insert a column into the worksheet where
    the column name is "TAX"
    the column number is 2
```

#### 2. Insert a Column by Specifying Column Name, Number, and Values

```
insert a column into the worksheet where
    the column name is "TAX"
    the column number is 2
    the values are 30, 40, 50
```


---

# 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/excel-v2/insert-a-column.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.
