# Insert a Table

### Overview

This procedure inserts a table into an Excel worksheet. The output is a modified worksheet with the table inserted.

{% hint style="warning" %}
The modified worksheet is **not** saved into the original Excel file.
{% endhint %}

### Syntax

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

<details>

<summary><code>insert the table into the worksheet</code></summary>

#### What does it do?

Begins table 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 location is "A1"</code></summary>

#### What does it do?

Specifies where to insert the table.

#### Where does it go?

Indented under `insert the table into the worksheet where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **A1** with a cell reference (e.g., "A1", "B2").

#### Example

```
the location is "B2"
```

</details>

<details>

<summary><code>the headers are header1, header2, header3 ...</code></summary>

#### What does it do?

Optionally specifies custom table headers.

#### Where does it go?

Indented under `insert the table into the worksheet where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **header1, header2, header3, etc.** with a list of header names.

#### Example

```
the headers are "Name", "Age", "Department"
```

</details>

### Examples

#### 1. Insert Table at Specific Location

Inserts a table starting at cell B2.

```
insert the table into the worksheet where
    the location is "B2"
```

#### 2. Insert Table with Custom Headers

Inserts a table with specified headers.

```
insert the table into the worksheet where
    the location is "A1"
    the headers are "Employee ID", "Name", "Salary"
```


---

# 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/extract-a-table-from-a-worksheet/insert-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.
