Introduction
This article describes how to get value from CSV file in Automation Anywhere using community edition. Sometimes we need to get value from CSV file and use them in our task so I will explain the same in this article.
CSV File
We have some data in a CSV file that we need to get in our bot.
Now I need to create bot to execute this code to get data from CSV file. If you are a beginner then need to check this article Getting Started Robotic Process Automation using Automation Anywhere to create environment of Automation Anywhere.
Create a New bot
After logging Automation anywhere account through cloud community edition link,
You will see a Dashboard as shown in below image and you can create a new bot through highlighted button ‘create a bot’-
Bot Configuration
After clicking on ‘create a bot’ button, you will get a popup window. It will ask some information about bot which you want to create like-
- Name of bot
- Description of bot(optional)
- Folder location of bot
After clicking on choose option, a popup window will come where you can browse ‘CSharpCorner’ folder and click on choose to set a default location for your new bot.
After creating bot, we need to create a variable to save outcome of csv file.
Create Variable for outcome
Let’s create a variable through left side variable pane and click on ‘+’ sign, and select ‘Table’ type and name as ‘OutputVariable’ and click on create button.
Open CSV File
Now Go to ‘Action’ pane on left side and find ‘CSV/TXT’ section. Drag & drop ‘Open’ into workspace. Follow the below steps
- Select ‘Desktop file’ tab
- Browse text file from computer which we created earlier (SampleCSVFile.csv) and having data.
Read CSV File
Now Go to ‘Action’ pane on left side and find ‘CSV/TXT’ section. Drag & drop ‘Read’ into workspace where we will select ‘OutputVariable’ for file outcome
Close CSV File
Now Go to ‘Action’ pane on left side and find ‘CSV/TXT’ section. Drag & drop ‘Close’ into workspace.
Message Box to show specific csv data from Output Variable
Go to ‘Action’ pane on left side and find ‘Message box’ section. Drag & drop ‘Message box’ into workspace to display specific data from output variable. We just need to add title name as ‘Get CSV Data’ and select ‘OutputVariable’ in message to display like mentioned below-
$OutputVariable[0][1]$
Here we will fetch 1st row and 2nd column as first row/column always starts with 0.
Where output will be look like after running the bot.
Conclusion
In this article, how to get value from a CSV file in environment of Automation Anywhere.