Build an automation that reads each row from an Excel spreadsheet and submits the
data into a web form, using the Excel advanced, Loop,
and Recorder
packages.
Before you begin
Before you start building the automation, you can create the
following data sets on your desktop in .xlsx format as below.
Table 1. Sample employee claims data
| Employee name |
Age |
Claim amount |
Claim date |
Claim type |
| Mike |
30 |
469 |
22/3/2022 |
Medical |
| Sarah |
34 |
766 |
28/3/2022 |
Dental |
| Chris |
41 |
428 |
13/05/2022 |
Medical |
| Samantha |
45 |
1000 |
09/05/2022 |
Medical |
The website URL that you enter must have a web form. A web form
enables you to enter and submit data to a server. So in this example, you can enter the
data from the Microsoft Excel spreadsheet into this web form.
About this task
This example demonstrates how to use the Excel Advanced, Loop, and Recorder packages
together to build an automation that reads each row of a spreadsheet and submits it as a
separate web form entry. The bot iterates through all rows in a Table variable, mapping
each column to a web form field.
Procedure
-
Create a new bot:
-
On the left panel, click Automation.
-
Click .
-
Select the required platform as the target runtime environment. For
example, Windows or
macos.
Note: Windows is the
default pre-selected platform.
-
In the Create Task Bot window, enter the bot name.
-
Accept the default folder location: \Bots\
To change the default bot storage location, click
Choose and follow the prompts.
-
Click Create and edit.
When you create a bot, the
platform type is also logged in the audit entry. The event type is
logged as Create bot.
Note: The default maximum size for individual bot is 50 MB.
-
Open the Excel file.
-
Double-click or drag the action.
-
Enter a session name.
-
Select the Excel file.
-
Select the Sheet contains a header option.
By selecting the Sheet contains a header option, you enable
the automation to search for the column by the header name during run time.
-
Launch the website.
-
Double-click or drag the
action.
-
Enter the website URL to enter the data.
-
Retrieve the worksheet values and store them in a Table variable.
-
Double-click or drag the action.
-
Enter the same session name you used in the action.
-
Select All rows from the drop-down list.
-
Create a Table variable using the icon to the right of the
Assign to variable drop-down list.
-
Instruct the automation to process the data row by row.
-
Double-click or drag the Loop action.
-
Select the For each row in table iterator.
-
Select the same Table variable that you used in Get multiple
cells.
-
Create a Record variable using the icon to the right of the Assign
to variable drop-down list.
The Record variable holds all of the values for one row. With each iteration of
the Loop, the automation retrieves the values of the next row and stores them in the
Record variable, overwriting the values from the previous row.
-
Map the first column header to the web form textbox.
-
Double-click or drag the action.
-
Select the same window you opened with the Open
action.
-
Select Capture object.
-
Hover over the textbox until a red outline appears.
-
Select the textbox.
-
Return to the Control Room.
-
Verify that the Control Type value is
TEXTBOX.
-
Select Set text from the
Action drop-down list.
-
In the Keystrokes field, insert the same Record
variable that you used in the Loop.
-
Select the By name option, then copy and paste the
first column header into the field.
-
Repeat the substeps in the "Map the first column header" step to map each remaining
column, with the following differences:
-
Instead of searching for the browser window title, insert the Window variable
generated by the Recorder.
-
When inserting the Record variable in the Keystrokes
field, copy and paste the subsequent column header into the "By name"
field.
-
Capture the Submit button.
-
Double-click or drag the action.
-
Insert the Window variable generated by the Recorder.
-
Select Capture object.
-
Verify that the Control Type value is
BUTTON.
-
Select the Click action.
-
Select Save.