uipath technical infomation for everyone

Write value to cell range


Use the Write Range activity or the Append Range activity to write values ​​to a cell range.

Write Range activity

The Write Range activity writes the data stored in the DataTable in one go. Because only the DataTable is compatible with the data to be written, it is necessary to populate the Datatable beforehand with the Read Range activity and the Build Datatable activity.

Suppose that there is Sheet1 in which the data below is written. Let’s look at an example of writing this on a plain Sheet2.

Read the values ​​of Sheet1 into the DataTable in the Read Range activity.

Now load the DataTable into Sheet2, using the Write Range activity.
If sheet2 does not exist, a new sheet is added and the data is written.

Write Range Activity Properties

Check when writing with

Properties Commentary
Data Table Specify the Data Table in which the value is stored.
Sheet Name Specify the sheet name. If no sheet exists, a new sheet is created with the specified sheet name.
Starting Cell Specify the start cell to write the value. If not specified, the value is written from “A1”.
Add Headers header.

Because the data written is unformatted, you need to prepare a pre-formatted sheet and write it on or write the data and then format it.

Append Range activity

The Append Range activity writes the data stored in the DataTable, but writes it in addition to the last data.

Suppose that there are data in Sheet1 and Sheet2 as follows. Let’s look at an example of adding the data of Sheet2 to the end of Sheet1.

Sheet1

sheet2

Deploy the Excel Application Scope.

Read Sheet2 into the DataTable in the Read Range activity.

Deploy the Append Range activity.

Set the properties of the Append Range activity.

Properties Commentary
DataTable Specify the Data Table in which the value is stored.
Sheet Name Specify the sheet name. If no sheet exists, a new sheet is created with the specified sheet name.

< Robot execution result >
The data of Sheet2 was written at the end of Sheet1. However, since the written data is not formatted, it is necessary to pre-format and write to the area or to format after writing the data.