Get Text from File

Gets the text from a specified file.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

getTextFromFile --filename(String) (String)=text

Dependencies

  • To use this command, open an Excel file with the Open Excel file (excelopen) command.

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
File path filename Required Text Path to the file to get the text from.

Output parameters

Designer mode label Script mode name Accepted variable types Description
Text text Text Text extracted from the file.

Example

The following code example demonstrates how to use the Get Text from File command to extract the text from an Excel file.

defVar --name textExtracted --type String
// Use a sample file.
getTextFromFile --filename "Sample file" textExtracted=text
logMessage --message "Result: ${textExtracted}" --type "Info"

Important: To use the sample script, use a sample excel file and enter its path in the File path parameter of the Get Text from File command.