Automation Anywhere Enterprise (Excel Commands)
Automation Anywhere Enterprise (Excel Commands)
Made By
Ajay Mehta
Senior Product Trainer
Automation Anywhere
Page No: 1
Objective of Walkthrough
The objective of this walkthrough is to make the end user comfortable with the excel
commands and he is comfortable with writing data into excel and also reading data from
excel to various other compatible software’s.
Page No: 2
Example 1: Reading Data from a CSV/TXT and writing into
a Excel spreadsheet
6) We choose “Read from CSV/Text” as below from the commands in the Task Editor as
below
Page No: 3
Specify Text/Csv file from
which data will be read
We specify
the file
delimiter,
which in our
case is comma
9)Next we want to position to cell “A1“ in excel , so that the write operation in our excel
sheet takes from that point , we choose “Excel – Goto Cell” command for the same , as
below
Page No: 5
10) Next we get inside the loop and start writing into the spreadsheet using “Excel -> Set
Cell” as below
Page No: 6
Pressing F2 will popup the following dialog as below :
We choose “Filedate Column” variable as seen above and click on insert which opens
another dialog as below , where we have to insert the column no as below
Page No: 7
For the first column , we will enter value as “1” , so that the final dialog looks like below
Page No: 8
Data
Entered in
Cell A1
Next , we want data to be entered in cell B1 , for that Active cell has to be made one right
of the current cell as below
Change
Active
Cell to
one
right.
12) For the above , we will use “Excel -> Goto Cell” as below
Page No: 9
13) The above command will position to the next column and we are good to assign value
to this new cell as below using “Excel – Set Cell” as below
Page No: 10
Pressing F2 will popup the following dialog as below :
We choose “Filedate Column” variable as seen above and click on insert which opens
another dialog as below , where we have to insert the column no as below
Page No: 11
We will choose 2 this time, as we need to write the value of the second column, so the
final dialog looks as below:
Page No: 12
14) Value is now entered in B1
So, the first row from the Text file is successfully written into the first row of our Excel
sheet, now for the next write operation the active cell has to be A2 as below
This will be achieved using two “Excel – Goto Cell” commands , the first will move the
current cell one down
Page No: 13
The Next “Excel – Goto Cell” will move it to the beginning of the row , in this case to A2 as
seen below
Page No: 14
This will take care of moving and writing in the spreadsheet.
15) Last but not the least we need to close the spreadsheet using “Excel – Close
Spreadsheet”
Page No: 15
16) Our Script Looks like as below
Page No: 16
Example 2: Reading Data from an Excel File and Writing
Into a Access Database
1) We first create an excel file and type some data into it as below
2) Also, we create a blank access database, create a table as below. We save the
database as .mdb.
This table has two fields “Name” and “Age” as seen above .
Page No: 17
3) We choose “Excel – Open Spreadsheet” command to open the spreadsheet and start
reading from it as below :
4)
The following dialog opens where we specify the path to our excel file which we have
to read as below
Page No: 18
5) Next we choose “Database – Connect” command as below :
Page No: 19
This opens the following window as below :
7)We give complete path of .mdb , and click on “Test Connection” , we should get “Test
Connection Succeeded” as below
Page No: 20
8)Next , we click on “Save” as below
Page No: 21
The database connection is created .
9) We create three variables col1 , col2 and isempty as below . The variable isempty will
act as a flag to keep a check on how many iterations need to be done over the excel file
till it reaches the end . col1 and col2 variables are used to hold the values read from
column 1 and column 2 of the excel file respectively .
Page No: 22
For isempty variable :
Page No: 23
For col2 variable :
Page No: 24
10) Next we choose “Excel – Goto Cell” to position our read from cell A2 as the first
row contains column names i.e “Name” and “Age” .
11) Next we choose “Loop – Condition” command to iterate over the excel rows and
read the contents
Page No: 25
Page No: 26
12)Next we choose “Excel – Get Cells” as below
Page No: 27
The value of the currently active cell is assigned to variable col1 .
Data Read
from Cell
A2
Next , we want data to be read from cell B2 , for that Active cell has to be made one right
of the current cell as below
Page No: 28
Change
Active
Cell to
one
right.
12) For the above , we will use “Excel -> Goto Cell” as below
13) Now we need to read value of current cell in col2 using “Excel – Get Cell” as below
Page No: 29
The value of the current cell is assigned to variable col2
14)Next we need to go one cell down and to the beginning of the next row using “Excel ->
Goto cell” as illustrated below :
Page No: 30
Then we need to go to the beginning of the next row :
The above is so that the next read can take place from column 1 of the next excel row
Page No: 31
For this , we do as below using “Excel – Goto Cell”
15) We have successfully set the navigation within our excel sheet for picking up
information
16)Next we choose “If Else – Variable “ , to check if the last read was not successful(i.e if
we have reached the end of our excel file )
Page No: 32
The above code checks if the value of “col1” is empty , if true we will assign the value “2”
to “isempty” variable , setting the flag condition to indicate end of read from excel .
17)We use the “ ” command to assign the value “2” to our “isempty”
variable as below
Page No: 33
18)Also , we insert value’s into our database which we have read from our excel files and
stored into variables col1 and col2 , after checking that col1 is not blank as below , Again
“If Else – Variable” is used
Page No: 34
19)Finally we disconnect from the database , using “Database – Disconnect” command as
below
Page No: 35
20)We choose “Save Task” and then “Run Task”
22)We have been successfully able to copy data from excel to access as seen above .
Page No: 36
Disclaimer statement
This training course is designed for information and education purpose only and
the contents hereof are subject to change without notice. This course is not
warranted to be error free, nor is it subject to any other warranties or
conditions, whether expressed orally or implied in law, including implied
warranties and conditions of merchantability or fitness for a particular purpose.
We specifically disclaim any liability with respect to this training course, and no
contractual obligations are formed either directly or indirectly by this course.
This training course either wholly or any of its parts may not be reproduced or
transmitted in any form or by any means, electronic or mechanical, for any
purpose, without our prior written permission.
© Copyright. Automation Anywhere, Inc. 2016. All rights reserved
Page No: 14