# Get a Table from a File

### Overview

This procedure imports a table from a file, which can be provided via direct upload to Kognitos or fetched from an S3 URL. It supports popular file formats such as CSV and Excel.

{% hint style="info" %}
It is recommended to use [Get the Worksheet](https://docs.kognitos.com/excel/worksheets/get-a-worksheet) followed by [Get the Worksheet's Table](https://docs.kognitos.com/excel/worksheets/get-an-item-from-an-excel-worksheet) when extracting tables from **Excel** files.
{% endhint %}

### Syntax

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

<details>

<summary><code>the file</code></summary>

#### What does it do?

Specifies the file to extract the table from.

#### 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 — Either specify an S3 url using **is** or leave this line as "the file" to raise an exception prompting a local file upload.

#### Example

```
the file is "s3://my-bucket/data/table.xlsx"
```

</details>

<details>

<summary><code>open the table at the file</code></summary>

#### What does it do?

Instructs the system to extract the table at the provided file.

#### 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 — Requires **the file** to be defined in the previous line.

</details>

### Examples

#### 1. Uploading a File Directly

Here, `the file` will raise a question prompting you to upload a file directly.

```
the file
open the table at the file
```

#### 2. Specifying an S3 URL

In this example, `the file` is provided as an S3 URL.

```
the file is "s3://my-bucket/data/table.xlsx"
open a table at the file
```
