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: Connect to Dropbox, Connect to Google Drive or Connect to Microsoft Corporation OneDrive, which must be pre-configured in the Web Client.
    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 IBM Robotic Process Automation Studio console the text of the given file.
    

    Download File

    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