CSV
Source: /
Read CSV data
Methods
getNumRows() → Number
Return the number of rows in the CSV file
- Returns
-
Number
Number of rows in CSV file
randomRow([hasHeader]) → module:CSVRow
Retrieve a random row in the CSV file.
By default assumes row 0 is the column names, and will not be returned.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
hasHeader |
Boolean |
Yes |
when set to true (the default) indicates that the first row of the CSV should be ignored. |
- Returns
randomValue(column) → String
Retrieve a value for the given column in the CSV file
Parameter
Name | Type | Optional | Description |
---|---|---|---|
column |
Number |
|
The column to retrieve |
- Returns
-
String
row(rowIndex) → module:CSVRow
Returns the given row of the CSV file as an array of strings (one value for each column).
Parameter
Name | Type | Optional | Description |
---|---|---|---|
rowIndex |
Number |
|
The row index to retrieve |
- Returns
size() → Number
Return the number of rows in the CSV file
- Returns
-
Number
Number of rows in CSV file
value(row, column) → String
Retrieve the value in the CSV table at the given row and column
Parameters
Name | Type | Optional | Description |
---|---|---|---|
row |
Number |
|
The row to retrieve |
column |
Number |
|
The column to retrieve |
- Returns
-
String