Table of Contents

CSV

This is the documentation of the CV module that implements a CSV loader.

Use require( "./example.csv", hop.csv )

This returns the csv elements as a JavaScript array or arrays.

Example

Assuming the file ex.csv

lbl1,lbl2,lbl3
1,10,45
56,2,54
87,,-10

The following Hop program

"use hopscript"

console.log( require( "./ex.csv", hop.csv ) );

outputs

[ [ 'lbl1', 'lbl2', 'lbl3' ],
  [ '1', '10', '45' ],
  [ '56', '2', '54' ],
  [ '87', '', '-10' ] ]

Functions

csv.load( file, [separator = ',', [encoding = 'ascii']] )

Parse a csv file and return an return it as an JavaScript array. The optional argument separator can be one of:

The encoding can be one of: