Tips and tricks Best practice guides, FAQ & more
The Write Excel block is used to write data into an Excel file. A user can select a range of header columns and then insert/append data into the Excel file under the selected columns.
When fully expanded, the Write Excel block appears as follows:
The green input connector in the header is used to trigger the block for executing a task.
The green output connector in the header is active for connecting the next building block in the flow, as necessary.
You can change the block title, Write Excel, by double-clicking it and entering a new title.
By clicking the Path to File ellipsis button, you will open the file dialog window for navigating to the desired Excel file to write to. You can also navigate to a file on a shared network path. After selecting the path, the file will be shown in the text field.
Note: The selected file can be directly modified, as the file is not save inside of LEAPWORK, but rather referenced from a path. Any modifications to the file data will require that you re-define the range if data has changed outside of the originally selected range.
Fields entered into the Text fields enable the use of external values (dynamic data) in the Path to File.
To use the value of an added field, right-click in the Path to File text field and select Insert token, then the Add new field name.
Fields can be renamed by double-clicking on them. The tokens will change their visual appearance accordingly.
Select the range and sheet inside of the Excel file that you want to write to by clicking on the Range Define button. In the Select Range popup window, select the columns and rows that you'll use:
When selecting the range, check the Use first row as header if you wish to use the first row’s column data for the field names in the block. In this example, the fields would be S. No., First Name, Role and Status.
It’s possible to select data from any sheets in the Excel file but, it’s only possible to select one data range per Write Excel building block.
The Not written green output connector is triggered if the block is not able to write to the Excel file or if the Excel file is not found.
This connector can be used to branch the execution of the flow, depending on whether the Write Excel block is not able to write to the Excel file or if the Excel 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, which can be connected for inserting data via blue connectors.
The data insertion method. Select between:
When using the Row index method, specify which row you want to write data to.
Updated September 17th 2019.