Read All Text

Verb: readAllText

Available from: <Standard>

Reads a text file and returns all its contents in a "Text" variable.

Syntax

readAllText --filepath(String) [--encoding(Nullable<EncodingType>)] [--fileSystem(FileSystem)] (List<String>)=lines (String)=value

Inputs

Script Designer Required AcceptedTypes Description
--filepath File path Required Text Full path to the text file that should be read.
--encoding Encoding Optional EncodingType Character encoding to use when reading text file:
  • ASCII
  • Automatic
  • Big Endian Unicode
  • Operating System Default
  • Unicode
  • UTF32
  • UTF7
  • UTF8
  • --fileSystem File system Optional File System Connection variable to a file system.
    1. To obtain the connection variable with an available file system, this connection must be established using one of the following commands: IBM RPA Control Center.
    2. If nothing is specified in this parameter, the local file system of the operating system is used as default.

    Outputs

    Script Designer AcceptedTypes Description
    value File text Text Variable with the text content of the given file.

    Example

    A text file is entered and read using the default coding and operating system file system. The text of the file is displayed through the Log Message command.

    defVar --name fileText --type String
    readAllText --filepath "readTextExample.txt" --encoding "Default" fileText=value
    logMessage --message "File text: ${fileText}" --type "Info"
    // Show in the console the text of the given file.
    

    Download File


    For the correct operation of the script above, it is necessary to download the file and enter its path in the File path parameter of the Read All Text command.

    See Also

  • Check If Directory Exists
  • Convert Base64 to File
  • Convert File to Base64
  • Copy File
  • Count Files
  • Create Directory
  • Delete Directory
  • Delete File
  • Delete from Directory
  • Download from File System
  • Get Directories
  • Get Files
  • If File Exists
  • Move File
  • Read All Bytes
  • Rename File
  • Send to File System
  • Write to File