Book demo
Start trial
Book demo
Start trial

 

Read Excel

The Read Excel block is used to read an Excel file, select a range of data and then use that data to drive an automation case.

See the Drive data with Excel lesson to get an example of how to use the Read Excel block.

When fully expanded, the following is an example of the Read Excel block with sample data:

ReadExcel

The Read Excel block header

The left green input connector in the header is used to trigger the block for executing a task.

The right green output connector in the header is triggered when a row from an Excel file has been read. If Method is set to Iterate, this output connector triggers on each iteration until all rows in the selected range are iterated through.

The block title Read Excel, can be changed by double-clicking on it and typing a new title.

Source Type

A user can choose any of the below options as a source type:

  1. Data File: File for upload will be saved inside of LEAPWORK
  2. Local Path: File for upload will be referred to from a specified path

Select Data File to read

By selecting Data File for uploading, it will open a file dialog so a user can choose which file to upload from a file system. After the file is selected, it will be saved in LEAPWORK.

Note: A user needs to re-upload the file if the file content has been modified.

Path to file

In the Read Excel block, clicking the Path to File option will open a file dialog so a user can choose a path to the file on the file system, which can also be a shared network path. Once selected, the file path will be shown in the text box.

Note: A user can directly update the file content, as the file is not save inside of LEAPWORK. Instead, it is referenced from a path. The range must be defined again in case more rows/columns have been added, otherwise the updated content from a previously defined range will be used.

Text fields

In the Read Excel block, fields enable the use of external values (dynamic data) in the Path to file.

To use the value of an added field, right-click the text field below the Path to file title and select Insert token, then enter the field’s name.

Fields can be renamed by double-clicking on them. The tokens will change their visual appearance accordingly.

Range

The range and sheet inside of the Excel file may be selected. Click the field to select the range and sheet in a popup window:

excel-block2

When selecting the range, check the Use first row as header button if you wish to use the first row’s column data in the block as the field name. In this example, the field would be Username, Password, Full name, and Role.

It’s possible to select data from any sheet in the Excel file but it’s only possible to select one data range in a Read Excel building block.

Not read

The right green output connector is triggered if the block is not able to read the excel file or the excel file is not found.

This connector can be used to branch the execution of the flow depending on whether the block is not able to read the excel file or if the file is not found.

Fields (named or columns)

Once the Excel file is loaded and a range has been selected, the column data for each row is accessible as fields.

Method

The data selection method. Select between:

  • First row - always select the first row in the range.
  • Row index - select a specific row, such as the 5th row.
  • Iterate - continue reading all rows in the range. The top connector is triggered for each data row in the selected data range.

Row index

When using the Row index method, specify which row you want to get data from.

Completed

If using the Iterate method, when the iteration is completed, the right green output connector is triggered.

Updated 19.9.19