# Get an Item from an Excel Worksheet

### Overview

This procedure retrieves a specific item from a worksheet, such as a table, multiple tables, or a key-value pair based on the specified key.

### Syntax

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

<details>

<summary><code>get the worksheet's item</code></summary>

#### What does it do?

Retrieves an item from 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 — Replace **item** with `table`, `tables`, or a specific key name. A reference to **the worksheet** must be previously defined in the automation.

#### Example

```
get the worksheet's table
```

</details>

<details>

<summary><code>the location is "A1:D10"</code></summary>

#### What does it do?

Specifies the cell range to search within.

#### Where does it go?

Indented under `get the worksheet's item where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **A1:D10** with a cell range in Excel format.

#### Example

```
the location is "A1:D10"
```

</details>

<details>

<summary><code>the header is "header1"</code></summary>

#### What does it do?

Specifies a header to search for.

#### Where does it go?

Indented under `get the worksheet's item where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **header1** with the header name.

#### Example

```
the header is "Employee Name"
```

</details>

<details>

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

#### What does it do?

Specifies multiple headers to search for.

#### Where does it go?

Indented under `get the worksheet's item where`.

#### Is it required?

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

#### Does it require data?

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

#### Example

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

</details>

<details>

<summary><code>the first header location is "A6"</code></summary>

#### What does it do?

Specifies the exact cell location of the first header (faster than name-based search).

#### Where does it go?

Indented under `get the worksheet's item where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **A6** with an Excel cell reference where the first header is located. Must be on the same row as the last header location.

#### Example

```
the first header location is "A6"
```

</details>

<details>

<summary><code>the last header location is "DR6"</code></summary>

#### What does it do?

Specifies the exact cell location of the last header (faster than name-based search).

#### Where does it go?

Indented under `get the worksheet's item where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **DR6** with an Excel cell reference where the last header is located. Must be on the same row as the first header location.

#### Example

```
the last header location is "DR6"
```

</details>

<details>

<summary><code>the row count is 40000</code></summary>

#### What does it do?

Limits the number of data rows to extract (excluding header).

#### Where does it go?

Indented under `get the worksheet's item where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **40000** with the number of data rows to extract. If omitted, extracts to the end of the worksheet.

#### Example

```
the row count is 40000
```

</details>

### Examples

#### 1. Get the Worksheet's Table

```
open the worksheet at "s3://bucket/key"
get the worksheet's table
```

#### 2. Get the Worksheet's Item by Key

```
open the worksheet at "s3://bucket/key"
get the worksheet's "Deal ID"
```

#### 3. Get Table with Location Filter

Retrieves a table from a specific cell range.

```
get the worksheet's table where
    the location is "A1:E10"
```

#### 4. Get Table with Header Filter

Retrieves a table that contains specific headers.

```
get the worksheet's table where
    the headers are "Pokemon", "Type", "Size", "Finishing Move"
```

#### 5. Get Table with Header Locations (Fast)

Retrieves a table using exact header cell locations - faster than name-based search.

```
get the worksheet's table where
    the first header location is "A6"
    the last header location is "DR6"
```

#### 6. Get Table with Header Locations and Row Limit

Retrieves a table using header locations with a specific number of data rows.

```
get the worksheet's table where
    the first header location is "A6"
    the last header location is "DR6"
    the row count is 40000
```
