# Convert a Table to Excel

### Overview

This procedure converts a table into an Excel (.xlsx) file format. You can optionally specify a custom filename for the Excel file and a custom name for the worksheet. If no custom names are provided, the system will use default values ("Workbook1.xlsx" for the file and "Sheet1" for the worksheet).

### Syntax

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

<details>

<summary><code>convert the table to an excel</code></summary>

#### What does it do?

Converts the current table to Excel format.

#### 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 table** must be defined in the automation.

</details>

<details>

<summary><code>the excel filename is "filename.xlsx"</code></summary>

#### What does it do?

Specifies a custom name for the Excel file.

#### Where does it go?

Indented under `convert the table to an excel where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **filename.xlsx** with your desired filename. The `.xlsx` extension will be automatically added if not provided. If not specified, a default name will be generated.

#### Example

```
the excel filename is "sales-report.xlsx"
```

</details>

<details>

<summary><code>the worksheet name is "worksheet-name"</code></summary>

#### What does it do?

Specifies a custom name for the worksheet within the Excel file.

#### Where does it go?

Indented under `convert the table to an excel where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **worksheet-name** with your desired worksheet name. If not specified, defaults to "Sheet1".

#### Example

```
the worksheet name is "Sales Data"
```

</details>

### Examples

#### 1. Convert Table to Excel with Default Names

Converts a table to Excel using default filename and worksheet name.

```
convert the table to an excel
```

#### 2. Convert Table to Excel with Custom Filename

Converts a table to Excel with a specific filename.

```
convert the table to an excel where
    the excel filename is "my-data.xlsx"
    the worksheet name is "Sales Data"
```

#### 3. Convert Table for Email Attachment

Converts a table to Excel and uses it as an email attachment.

```
convert the table to an excel where
    the excel filename is "monthly-report.xlsx"
send "Monthly Report" to "manager@company.com" with
    the attachment is the excel
```
