Extract a Table from a Worksheet

Locates and extracts a table from an Excel worksheet.

Overview

This procedure locates and extracts a table from an Excel worksheet.

Syntax

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

extract a table from the worksheet

What does it do?

Begins table extraction 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 — A reference to the worksheet must be defined in the automation.

the description is "table-description"

What does it do?

Describes the table to be extracted.

Where does it go?

Indented under extract a table from the worksheet where.

Is it required?

❌ No — This phrase is optional.

Does it require data?

✅ Yes — Replace table-description with a text description of the table you want to extract.

Example

the description is "sales data with monthly totals"
the location is "A1:D10"

What does it do?

Specifies the cell range containing the table.

Where does it go?

Indented under extract a table from the worksheet where.

Is it required?

❌ No — This phrase is optional.

Does it require data?

✅ Yes — Replace A1:D10 with a cell range in Excel format that specifies the top-left and bottom-right corners of the table.

Example

the location is "A1:D10"
the first header is "x"

What does it do?

Specifies the leftmost column header to start extraction.

Where does it go?

Indented under extract a table from the worksheet where.

Is it required?

❌ No — This phrase is optional.

Does it require data?

✅ Yes — Replace x with the name of the first column header.

Example

the first header is "Name"
the last header is "y"

What does it do?

Specifies the rightmost column header to end extraction.

Where does it go?

Indented under extract a table from the worksheet where.

Is it required?

❌ No — This phrase is optional.

Does it require data?

✅ Yes — Replace y with the name of the last column header.

Example

the last header is "Total"
the first header location is "A6"

What does it do?

Specifies the exact cell location of the first header.

Where does it go?

Indented under extract a table from the worksheet 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"
the last header location is "DR6"

What does it do?

Specifies the exact cell location of the last header.

Where does it go?

Indented under extract a table from the worksheet 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"
the row count is 40000

What does it do?

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

Where does it go?

Indented under extract a table from the worksheet 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

Examples

1. Extract Table by Description

extract a table from the worksheet where
    the description is "This is a table which calculates housing cost information"

2. Extract Table by Cell Range

Extracts a table from a specific cell range.

extract a table from the worksheet where
    the location is "A1:D15"

3. Extract Table by Header Range

Extracts a table between specified column headers.

extract a table from the worksheet where
    the first header is "Employee ID"
    the last header is "Department"

4. Extract Table by Header Locations (Fast)

Extracts a table using exact header cell locations - faster than header name matching.

extract a table from the worksheet where
    the first header location is "A6"
    the last header location is "DR6"

5. Extract Table by Header Locations with Row Limit

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

extract a table from the worksheet where
    the first header location is "A6"
    the last header location is "DR6"
    the row count is 40000

Last updated

Was this helpful?