convert-text-to-datatable
Description
convert-text-to-datatable
adaptor converts DSV text into a datatable using specified separators to denote the split for columns and new rows.
The default character used as column delimiter is ,
(comma), this can be changed by setting the delimiter
input. The default character used as row delimiter is (LF), this can be changed by setting the newline
input.
Inputs
csv
Type: text
Required: Yes
The text to be converted to datatable.
delimiter
Type: text
Required: No
Character used as column delimiter. If unspecified, defaults to "," (comma).
newline
Type: text
Required: No
Character used as line separator. If unspecified, defaults to (newline).
trim
Type: boolean
Required: No
Specifies whether to ignore whitespace characters immediately around the separator. If unspecified, defaults to True
.
columns
Type: list
Required: No
List of column names to be added. If unspecified, first row of the file will be used as column names.
Outputs
data
Type: datatable
A datatable.
Examples
Example 1: Default behaviour.
Inputs:
text
:
Outputs:
data
:
1997
Ford
E350
2000
Mercury
Cougar
-> Converted CSV text to a datatable.
Example 2: Convert text with vertical bar as value separator and semicolon as row separator.
Inputs:
text
:
delimiter
: |
(vertical bar)
newline
: ;
(semicolon)
Outputs:
data
:YearMakeModel1997
Ford
E350
2000
Mercury
Cougar
-> Converted text with vertical bar as a value separator and semicolon as a row separator to a datatable.
Example 3: Text without header line.
Inputs:
text
:
columns
:
Column1
Column2
Column3
Outputs:
data
:
1997
Ford
E350
2000
Mercury
Cougar
-> Converted text without header line to a datatable.
Use Cases
Add small reference dataset into a workflow rather than adding a file or user-provided input.
Last updated