extractByIndex(index, rowOffset)

Extracts the value from the specified column and row.

This function can be used to extract data from CSV or XLS(X) files that have an identical structure but don't have the same column names.

index

Number that represents a column in a CSV or XLS(X) file (1-based).

rowOffset

Optional. Number that represents the row index (zero-based), relative to the current position. To extract the current row, specify 0 as the rowOffset. Use moveTo() to move the pointer in the source data file (see moveTo()). When omitted, the current row will be extracted.

Examples

The script command data.extractByIndex(1,0); means that the extraction is made on the first column in the first row, relative to the current position.

The following script puts the values of all columns of the current row into one array. The values could then be stored as a JSON array in a single extracted field.

var allFields=[];
var i=1;
while (data.fieldExistsByIndex(i)) {
   allFields.push(data.extractByIndex(i++));
}