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.

    Install plug-ins

  • Ensure that you are familiar with how to build your bot using Object Cloningto follow the process in this procedure.

    Build your first bot using Object Cloning command

Procedure

  1. Log in to the Enterprise Client.
  2. Click New.
  3. In the Automate window, click Workbench.
  4. 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.
    1. vVendorName
    2. vVendorID
    3. vPrimaryContact
    4. vStreetAddress
    5. vCity
    6. vState
    7. vZip
    8. vEmail
    9. vActiveDiscount
    10. vNDA
  5. 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:
    1. 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.
    2. Step 2: Start in Path: You can skip this step.
    3. Step 3: Parameters: Enter the URL for the Automation Anywhere CSV page: https://www.automationanywhere.com/automationanywherelabs/intro-to-csv.html
    4. Click Save.
  6. Click Save to save your bot as Tutorial3_WorkingWithCSV.atmx.
  7. Click Run to test it.
  8. 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.
    1. 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.
    2. In the Select Action to Perform drop-down list, select Left Click.
    3. Click Save.
  9. From the Commands tab, expand (+) the Excel basic list, and select and drag the Open Spreadsheet command to the Actions List.
    1. 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.
    2. Click Save.
  10. From the Commands tab, expand (+) the Excel basic list, and select and drag the Open Spreadsheet command to the Actions List.
    1. 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.
    2. Click Save. Repeat the process of extracting the remaining values from the Excel Spreadsheet mapping each to previously created variables.
    3. vVendorID: enter B2.
    4. vPrimaryContact: enter C2.
    5. vStreetAddress: enter D2.
    6. vCity: enter E2.
    7. vState: enter F2.
    8. vZip: enter G2.
    9. vEmail: enter H2.
    10. vActiveDiscount: enter I2.
    11. vNDA: enter J2.
  11. In the Object Cloning window, select Automation Anywhere Labs - CSV - Google Chrome.
    1. 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.
    2. In the Select Action to Perform drop-down list, select Set Text.
    3. In the Text to Set field, press F2 to open the Insert Variable window and select vVendorName.
    4. Click Save.
  12. 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.
  13. From the Commands tab, expand (+) the IF/ELSE command to open a series of IF/ELSE commands.
    1. Click and drag the If/Else Variable command to the bottom of the Actions List.
    2. Click Edit next to the IF Condition field.
    3. Set the Variable field, press F2 and select vActiveDiscount from the Insert Variable window.
    4. Set the Operator drop-down value to Equal To (=).
    5. Select the Fix option and enter YES.
    6. Click Save.
  14. Inside the vActiveDiscount = YES conditional statement, add an Object Cloning command to click the Yes option.
  15. From the Commands tab, expand (+) the IF/ELSE command to open up a series of IF/ELSE commands.
  16. Click IF/ELSE and drag the Else command and place it below the Object Cloning command, but before the End If command.
  17. After the Else command but before the End If line, add another Object Cloning command to click the No option on the CSV page.
  18. From the Commands tab, expand (+) the IF/ELSE command to open a series of IF/ELSE commands.
    1. Click and drag the If/Else Variable command to the Actions List.
    2. Click Edit next to the IF Condition field.
    3. Set the Variable field, press F2 and select the vNDA from the Insert Variable window.
    4. Set the Operator drop-down value to Equal To (=).
    5. Select the Fix option and enter YES.
    6. Click Save.
  19. Inside the vNDA = YES conditional statement, add the Object Cloning command to click the Yes check box on the CSV page.
  20. After the vNDA = YES End If statement, add the Object Cloning command to click the Register option on the CSV page.
  21. From the Commands tab, expand (+) the Excel command to open up a series of Excel commands.
    1. Add the Close Spreadsheet command to the bottom of the Actions List.
    2. Click Save.
  22. Save your bot and click Run.