Module | Ruport::Data::Table::FromCSV |
In: |
lib/ruport/data/table.rb
|
Loads a CSV file directly into a Table using the FasterCSV library.
Example:
# treat first row as column_names table = Table.load('mydata.csv') # do not assume the data has column_names table = Table.load('mydata.csv',:has_names => false) # pass in FasterCSV options, such as column separators table = Table.load('mydata.csv',:csv_options => { :col_sep => "\t" })
Creates a Table from a CSV string using FasterCSV. See Table.load for additional examples.
table = Table.parse("a,b,c\n1,2,3\n4,5,6\n")