Tips and tricks Best practice guides, FAQ & more
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:
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.
A user can choose any of the below options as a source type:
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.
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.
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.
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:
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.
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.
Once the Excel file is loaded and a range has been selected, the column data for each row is accessible as fields.
The data selection method. Select between:
When using the Row index method, specify which row you want to get data from.
If using the Iterate method, when the iteration is completed, the right green output connector is triggered.