Downloading the Excel file

In the previous chapters there were quite many new things to learn, but this chapter will be quite easy for Automation Studio users.

Each week, the actual sales data is exported from the company's sales system and uploaded to the intranet. Our robot will need to get the data out of the Excel file and fill the sales form for each sales representative. But first, it needs to download the Excel file.

Create a new User Keyword called Download The Excel File and place it below the Fill And Submit The Form in the task like this:

Update task by adding the new keyword

Great! Now we have to implement the keyword.

Tip: you can double-click on the keyword in the task to jump to it quickly.

Downloading the file

Let's use the Download keyword to download the Excel file. It requires a URL as an argument. We know that we can expect our Excel file at each week. Add it to the Download The Excel File keyword.

Set the URL address, and turn on Overwrite as in the image below (this sets the overwrite keyword argument to True). This way, we can count on the local file being always the most recent version: if the file exists, the robot has our permission to overwrite it.

Set the Target File to %{ROBOT_ROOT}${/}SalesData.xlsx. Don't worry about this too much now. You could leave this empty, too, but this guarantees that the Excel file gets placed inside the robot folder.

Download keyword setup

Let's run the robot and see if it works. Try running it via keyboard command this time, type Ctrl+Shift+R on Windows (Command-Shift-R on macOS) and then press enter key.

Palette for running

Great! Our robot has downloaded the remote file (SalesData.xlsx). You should find the file amongst your other robot files.

What we learned

  • You can use the Download keyword from the RPA.HTTP library to easily download remote files to your local computer.
  • The Download keyword can be configured to overwrite an existing file of the same name if found.