Build a bot to download and extract data from a CSV file
- Última atualização2020/04/17
Build a bot to download and extract data from a CSV file
Build a bot to download and extract data from a CSV file and use the data to fill out a web form.
Prerequisites
- To capture UI objects from a web page, ensure you have installed the product-specific Automation Anywhere Enterprise extension to automate web applications in Google Chrome.
- Ensure that you are familiar with how to build your bot using Object Cloningto follow the process in this procedure.
Procedure
- Log in to the Enterprise Client.
- Click New.
- In the Automate window, click Workbench.
-
Open the Variable Manager, click
Add to Create New Variables
and add the following variables. Click Save to save each
new variable. Click Yes to assign the NULL value to
variables.
- vVendorName
- vVendorID
- vPrimaryContact
- vStreetAddress
- vCity
- vState
- vZip
- vEmail
- vActiveDiscount
- vNDA
-
From the Commands tab, select and drag the
Open Program/File
command to the Actions List. In
the
Open Program/File
window, perform these
steps:
-
Step 1: Program/File Path: Browse and select the
Google Chrome executable file. Find the file location on your machine,
which can be: C:\Program Files
(x86)\Google\Chrome\Application. In the
Application folder, select
chrome.exe
. - Step 2: Start in Path: You can skip this step.
- Step 3: Parameters: Enter the URL for the Automation Anywhere CSV page: https://www.automationanywhere.com/automationanywherelabs/intro-to-csv.html
- Click Save.
-
Step 1: Program/File Path: Browse and select the
Google Chrome executable file. Find the file location on your machine,
which can be: C:\Program Files
(x86)\Google\Chrome\Application. In the
Application folder, select
- Click Save to save your bot as Tutorial3_WorkingWithCSV.atmx.
- Click Run to test it.
-
From the Commands tab, select and drag the
Object Cloning
command to the Actions List. In
the window, select Automation Anywhere Labs - CSV - Google
Chrome. Verify that the target browser session is open in its
own window.
- With the Object Cloning window open, click and hold the Capture button. While still holding the left mouse button, highlight the Download CSV on the CSV page until a red border blinks around it. Now release the button.
- In the Select Action to Perform drop-down list, select Left Click.
- Click Save.
-
From the Commands tab, expand (+) the
Excel basic
list, and select and drag the
Open Spreadsheet command to the Actions List.
- In the Open Spreadsheet window, in the Spreadsheet Path, enter the path to the CSV file. Find the file location on your machine, which can be: C:\Users\<your user name>\Downloads\MissingVendor.csv.
- Click Save.
-
From the Commands tab, expand (+) the
Excel basic
list, and select and drag the
Open Spreadsheet command to the Actions List.
- In the Excel Command window, select Get Cells, and select the Specific Cell option. In the Specific Cell field, enter A2. In the Assign value of to variable drop-down list, select vVendorName.
- Click Save. Repeat the process of extracting the remaining values from the Excel Spreadsheet mapping each to previously created variables.
-
vVendorID
: enter B2. -
vPrimaryContact
: enter C2. -
vStreetAddress
: enter D2. -
vCity
: enter E2. -
vState
: enter F2. -
vZip
: enter G2. -
vEmail
: enter H2. -
vActiveDiscount
: enter I2. -
vNDA
: enter J2.
-
In the Object Cloning window, select
Automation Anywhere Labs - CSV - Google Chrome.
- With the Object Cloning window open, click and hold the Capture button. While still holding the left mouse button, highlight the Vendor Name on the CSV page until a red border blinks around it. Now release the button.
- In the Select Action to Perform drop-down list, select Set Text.
- In the Text to Set field, press F2 to open the Insert Variable window and select vVendorName.
- Click Save.
- Repeat Step 11 to capture other fields from the CSV page, such as Vendor ID, Primary Contact, Street Address, State, Zip, and Email. Repeat Steps 11a and 11b, and in 11c in the Insert Variable window, select the corresponding variables.
-
From the Commands tab, expand (+) the
IF/ELSE
command to open a series of IF/ELSE commands.
- Click and drag the If/Else Variable command to the bottom of the Actions List.
- Click Edit next to the IF Condition field.
- Set the Variable field, press F2 and select vActiveDiscount from the Insert Variable window.
- Set the Operator drop-down value to Equal To (=).
- Select the Fix option and enter YES.
- Click Save.
- Inside the vActiveDiscount = YES conditional statement, add an Object Cloning command to click the Yes option.
- From the Commands tab, expand (+) the IF/ELSE command to open up a series of IF/ELSE commands.
- Click IF/ELSE and drag the Else command and place it below the Object Cloning command, but before the End If command.
- After the Else command but before the End If line, add another Object Cloning command to click the No option on the CSV page.
-
From the Commands tab, expand (+) the
IF/ELSE
command to open a series of IF/ELSE commands.
- Click and drag the If/Else Variable command to the Actions List.
- Click Edit next to the IF Condition field.
- Set the Variable field, press F2 and select the vNDA from the Insert Variable window.
- Set the Operator drop-down value to Equal To (=).
- Select the Fix option and enter YES.
- Click Save.
- Inside the vNDA = YES conditional statement, add the Object Cloning command to click the Yes check box on the CSV page.
- After the vNDA = YES End If statement, add the Object Cloning command to click the Register option on the CSV page.
-
From the Commands tab, expand (+) the
Excel command to open up a series of
Excel commands.
- Add the Close Spreadsheet command to the bottom of the Actions List.
- Click Save.
- Save your bot and click Run.