I'm Anthony, and here at LEAPWORK, we’re always looking for cool and innovative ways to further automate your most repetitive tasks. So this time, we’ve come up with another really useful and cool feature, the Write Excel building block.
The Write Excel block works in a similar fashion to the Read Excel block but now writes data to a selected range of columns and rows in any target file.
In this flow, we’re simply going to access an existing Excel file, read its contents, perform some calculations, and write the results to the same Excel file.
First, I’ll drag an output connector from the Start block and add the Read Excel block. Next, since the source file is on my local computer, I’ll tell the building block where to access the file by clicking on the Path to file ellipsis button. Choose the file and next select the Range, highlighting and dragging your cursor to capture the exact data that you want to read. Check the Use first row as a header box and click the Save button.
You can now see the first row of headers right here (showing headers with mouse cursor)
Now, chose whether you want LEAPWORK to read only the First row, a specific row, or Iterate through each of the rows.
Once you’ve got this setup, you can add a Calculate block and drag an output connector from row header Num1 to the Value A property on the Calculate block.
Do the same for Num2. Now select your Calculation method. In my case, I’m subtracting two column values to get the desired result.
Now add a Write Excel block, connect the Read Excel block to this block, and open the same file as you did with the Read Excel file. Select the Range where the calculation should be written, then check the Use first row as header button, and click the Save button. Then connect the Result number output connector on the Calculate block to the Result property on the Write Excel block.
Next, connect the Read Excel Current Index output connector to the Write Excel Row index property. This informs the Write Excel block which row to write to.
Lastly, add a Pass block, then connect an output connector from the Completed property to the Pass block and run your flow. (showing results)
Here’s a more complex Write Excel case, we’ll read some online weather service data and write it to Excel. (showing results)
In summary, the Write Excel building block is a powerful feature that lets you perform most, if not all, Excel tasks, all from LEAPWORK.
Let us show you how we automate. To learn more, visit us, at leapwork.com