Divooka Reference

CSV Files

4 nodes

On this page 4

Parse CSV

Function

A table from CSV text typed or pasted into the node - the quickest way to make a small table by hand.

Signature
ParseCSV -> Table
    text: Text
    delimiter: Text
    header: Truth
    inferTypes: Truth
    skipRows: Integer
Table ParseCSV(
    string text = "Name,Value\nAlpha,1\nBeta,2\nGamma,3",
    string delimiter = "auto",
    bool header = true,
    bool inferTypes = true,
    int skipRows = 0)

Parameters

nametypedefaultdescription
textTextName,Value Alpha,1 Beta,2 Gamma,3The CSV text.
delimiterTextautoWhat separates the cells: "auto", or a comma, semicolon, "tab" or bar.
headerTruthTrueWhether the first line holds the column names.
inferTypesTruthTrueWhether to read numbers, truths and dates as such.
skipRowsInteger0How many lines to pass over first.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
CSV Files
Package
Data Analytics

Read CSV

Function

A table from a CSV file: a column per field, each read as numbers, truths or dates where every value reads as one, and as text otherwise. The delimiter is told from the file unless one is given.

Signature
ReadCSV -> Table
    path: Text
    delimiter: Text
    header: Truth
    inferTypes: Truth
    skipRows: Integer
Table ReadCSV(
    string path,
    string delimiter = "auto",
    bool header = true,
    bool inferTypes = true,
    int skipRows = 0)

Parameters

nametypedefaultdescription
pathText—The file.
delimiterTextautoWhat separates the cells: "auto" to tell from the file, or a comma, semicolon, "tab" or bar.
headerTruthTrueWhether the first row holds the column names.
inferTypesTruthTrueWhether to read numbers, truths and dates as such; everything is text otherwise.
skipRowsInteger0How many lines to pass over first - a title, notes above the table.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
CSV Files
Package
Data Analytics

To CSV

Function

A table as CSV text.

Signature
ToCSV(table: Table, delimiter: Text, header: Truth) -> Text
string ToCSV(
    Table table,
    string delimiter = ",",
    bool header = true)

Parameters

nametypedefaultdescription
tableTable—The table.
delimiterText,What separates the cells: a comma, semicolon, "tab" or bar.
headerTruthTrueWhether to write the column names first.

Returns

TextText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
CSV Files
Package
Data Analytics

Write CSV

Function

Writes a table to a CSV file - UTF-8 with a byte-order mark, so a spreadsheet reads accents correctly - and gives back the file's path.

Signature
WriteCSV -> Text
    table: Table
    path: Text
    delimiter: Text
    header: Truth
string WriteCSV(
    Table table,
    string path,
    string delimiter = ",",
    bool header = true)

Parameters

nametypedefaultdescription
tableTable—The table.
pathText—The file to write; its folder is created if need be.
delimiterText,What separates the cells: a comma, semicolon, "tab" or bar.
headerTruthTrueWhether to write the column names first.

Returns

PathText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
CSV Files
Package
Data Analytics