How To Get Text From Text File In Automation Anywhere


This article describes how to get a text from a text file in Automation Anywhere using the community edition. Sometimes we need to get text from text file and use it in our task, so I will explain the same in this article.

Text File

We have some text or string in a text file that we need in our bot.

Now I need to create a bot to get this text from 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, you need to create a variable to save outcome of text file.

Create Variable for outcome

Let’s create a variable through left side variable pane and click on ‘+’ sign, and select ‘String’ type and name as ‘OutputVariable’ and click on create button.

Get Text from Text File

Now Go to ‘Action’ pane on left side and find ‘Text file’ section. Drag & drop ‘Get text’ into workspace. Follow the below steps

  • Select ‘Desktop file’ tab
  • Browse text file from computer which we created earlier(TextFile.text) and having below text
  • You need to select text encoding where ‘Detect automatically’ is default value
  • Select ‘OutputVariable’ for file outcome

Hello, This text is coming from text file.

Message Box to show Output Variable

Go to ‘Action’ pane on left side and find ‘Message box’ section. Drag & drop ‘Message box’ into workspace to display output variable. You need to just add title name as ‘Show File Output’ and select ‘OutputVariable’ in message to display.

Where output will look like after running the bot.


In this article, how you can get a text which exists in a text file in environment of Automation Anywhere.

Similar Articles