# Write DataTable to Excel

> `UiPath.Excel.Activities.Business.WriteRangeX`

`UiPath.Excel.Activities.Business.WriteRangeX`

Writes a data table that was saved for later to an Excel file. The activity can be used with Excel files selected for parent [Use Excel File](https://docs.uipath.com/activities/other/latest/productivity/excel-application-card) activities or with the Project Notebook.

:::important
This activity takes data from a DataTable enter memory and writes it into Excel. If you need to move data from one Excel location to another Excel location, use the [Copy/Paste Range](https://docs.uipath.com/activities/other/latest/productivity/copy-paste-range-x) activity.
:::

## Configuring the activity

#### In the body of the activity

* **What to write** - Select the plus sign, then use one of the options in the menu to indicate the data to write:
  + Select an Excel file, and then a named range, table, or sheet. To open the file and select a range directly from the file, select **Indicate in Excel**. Alternatively, you can select **Custom Input** to enter the range manually.
  + **Use Saved Value** - Select a data table value that you previously saved for later use in the project.
  + **Open in Advanced Editor** to enter a VB expression.
* **Destination** - Select the plus sign, then, from the menu, select the Excel file and then a named range, table, or sheet where to write the data, **Indicate in Excel** to open the file and select a range directly from the file, or **Custom Input** to enter the destination range manually.
* **Append** - If selected, the data is added starting with the first blank row in the destination range. If not selected, the data is added starting with the first row in the destination range, replacing any existing data. This option is not selected by default.
* **Exclude headers** - If selected, the header row or the first row in the source range is not written in the destination range. This option is not selected by default.

#### Properties panel

**Common**

* **DisplayName** - The name displayed for the activity in the Designer panel.

**Input**

* See **What to write** in the body of the activity.

**Misc**

* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level.

**Options**

* See the options in the body of the activity.

**Output**

* See **Destination** in the body of the activity.

:::important
There is a known limitation where an out-of-memory error occurs while trying to write a data table in Excel using the **Write DataTable to Excel** activity. The issue happens when attempting to read values with the `=` or `'=` prefix characters from Excel documents. As a solution, replace the `=` or `'=` prefixes with other characters.
:::
