# Insert a Row

### Overview

This procedure inserts a new row into an existing Excel worksheet at a specified row number. Existing rows are shifted down. This allows you to add rows without overwriting existing content in the worksheet.

### Syntax

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

<details>

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

#### What does it do?

Begins row 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 row number is n</code></summary>

#### What does it do?

Specifies where to insert the new row.

#### Where does it go?

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

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **n** with a row number (1-based). Existing rows will be shifted down.

#### Example

```
the row number is 2
```

</details>

<details>

<summary><code>the values are "value1", "value2", "value3" ...</code></summary>

#### What does it do?

Specifies the data to insert into the new row.

#### Where does it go?

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

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **value1, value2, value3, etc.** with a list of values for the row cells. If not specified, the row will be empty.

#### Example

```
the values are "John", "25", "Engineer", "New York"
```

</details>

### Examples

#### 1. Insert a Row by Specifying a Row Number

```
insert a row into the worksheet where
    the row number is 2
```

#### 2. Insert a Row by Specifying a Row Number and Values

```
insert a row into the worksheet where
    the row number is 2
    the values are "Earth", "Water", "Fire", "Air"
```


---

# 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/get-a-row/insert-a-row.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.
