# 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"
```
