Get Table from a Text File

Verb: textReadTable

Available from: <Standard>

Gets a data table from a text file using character or size separators.

Syntax

textReadTable [--hasheaders(Boolean)] [--usefunction(Boolean)] [--operator(ConditionalOperators)] --right(String) [--negate(Boolean)] [--stopwheninvalid(Boolean)] [--readfromstart(Boolean)] --delimiter(TextDelimiterOption) --characters(String) --lengths(List<Numeric>) --file(TextFileReader) (DataTable)=value

Inputs

Script Designer Required AcceptedTypes Description
--hasheaders Has headers Optional Boolean When enabled, interprets the worksheet's first line as a header.
--usefunction Validate lines Optional Boolean When enabled, allow a validation to be added to the table lines.
--operator Operator Optional ConditionalOperators Conditional operator that is applied to each table row. The available operators are:
  • Begins with
  • Contains
  • Ends with
  • Equal to
  • Is null or empty
  • Matches
  • --right Comparison value Only whenValidate lines is True Text Value used in comparison with each value of the table rows.
    --negate Negate Optional Boolean When enabled, negates the result of the validation.
    --stopwheninvalid When invalid Optional Boolean This option must be enabled to stop reading when a row is invalid in validation.
    --readfromstart Read from start Optional Boolean This option must be enabled so that the file reading starts at the beginning instead of the current position.
    --delimiter Delimiter type Required TextDelimiterOption Option for the type of separator used for reading. The available types are:
  • By Characters
  • By Length
  • --characters Delimiter Only whenDelimiter type is ByCharacters Text Separator (delimiter) used to identify table columns.
    --lengths Lenghts Only whenDelimiter type is ByLengths List<Number>, Text Length in characters of each cell.
    --file File reader Required Text File Reader Variable with the text file to open for reading.

    Outputs

    Script Designer AcceptedTypes Description
    value Data table Data Table List with data obtained from the table.

    Example

    Example 1: Obtains data from a table through the specified size separators "5,3,8", returning such data in a list.

    defVar --name textReader --type TextFileReader
    defVar --name dataTable --type DataTable
    // Open the file informed for reading.
    // Download the following file to execute the command.
    openTextReader --share "ReadWrite" --path "tableText.txt" --encoding "Default" textReader=value
    textReadTable --hasheaders  --delimiter "ByLengths" --lengths "5,3,8" --file ${textReader} dataTable=value
    logMessage --message "${dataTable}" --type "Info"
    

    For the correct operation of the script above, it is necessary to download the file and enter its path in the "Path" parameter of the command "Open Text File for Reading".

    Example 2: Get data from a table through the specified character separator "/", returning such data in a list.
    defVar --name textReader --type TextFileReader
    defVar --name dataTable --type DataTable
    // Open the file informed for reading.
    // Download the following file to execute the command.
    openTextReader --share "ReadWrite" --path "tableText.txt" --encoding "Default" textReader=value
    textReadTable --hasheaders  --delimiter "ByCharacters" --characters "/" --file ${textReader} dataTable=value
    logMessage --message "${dataTable}" --type "Info"
    

    Download File


    For the correct operation of the script above, it is necessary to download the file and enter its path in the "Path" parameter of the command "Open Text File for Reading".

    Remarks

    In Lenghts, the cell length must respect the smallest cell size in each column. To use the Get Table from a Text File command, you must have a text file open for reading, obtaining it with the Open Text File for Reading command.

    See Also

  • Binary Read Int
  • Close Binary File
  • Close Text File
  • Get Binary File Boolean
  • Get Binary File Characters
  • Get Binary File Text
  • Get Date and Time in Binary
  • Get Text File Line
  • Go to Text Reader Line
  • Move Index in Binary File
  • Open Binary File for Reading
  • Open Binary File for Writing
  • Open Text File for Reading
  • Open Text File for Writing
  • Read Binary File Decimal
  • Read Binary File Time Span
  • Read Delimited Line of Text File
  • Read Text to the End
  • Save Changes to Binary File
  • Save Changes to Text File
  • Write Boolean in Binary File
  • Write Date Time in Binary File
  • Write Decimal to Binary File
  • Write Delimited Text Line to Text File
  • Write Delimited Texts in Text File
  • Write in Text File
  • Write Integer to Binary File
  • Write Text in Binary File
  • Write Text Line to Text File
  • Write Time Span in Binary File