Task Description:
Migrate data from Excel to Database.
| Solution |
| 1. | Create new task |
Click on New->Task Editor |
| 2. | Connect to the database |
Using the Database command from the Application category specify a
connection string to connect to the Database Screenshot 1.
Connect to '<database connection string> |
| 3. | Copy records from Excel |
- Let's say you want to transfer Excel records as shown in Screenshot 2
- Create 4 variables, $Firstname$, $Lastname$, $City$ and $Country$ of type value from Tools->Variable Manager.
- Copy each cell from Excel and assign the value of Clipboard to
respective variables using 'Assign From Clipboard' option in Clipboard command.
|
| 4. | Transfer records to the Database |
- Specify Insert query to insert records in destination database. The insert query for this example
looks like as follows
INSERT INTO Addresses ( FirstName, [Last Name], City, Country ) VALUES ('$FirstName$', '$LastName$',
'$City$', '$Country$');
- Put these commands in a Loop for as many times as you want to transfer the records from Excel.
- The final task would look as shown in Screenshot 3
|
| |
When you run this task, it connects to the source database, copies the
excel records, with insert query in loop it will add all the records to destination table in the database. This tutorial
demonstrates use of one of the very powerful features of Automation Anywhere, 'Database' applications. Use this when you
want to migrate large numbers of records from excel or other applications to any database. |
Screenshot 1: 
Screenshot 2: 
Screenshot 3: 
|