Questions tagged [fastercsv]

Popular Ruby library/gem for working with CSV format files.

FasterCSV is a very popular Ruby gem for workin with CSV (comma-separated values) format files and data. It can import, export, and perform various other operations on data in CSV format.

164 questions
0
votes
1 answer

FaterCSV Encoding Issue

I am using fastercsv gem for csv export with utf-8 encoding. When ever i export any arabic content in my csv using utf-8 , when i try to open in windows it comes out as some strange characters. where as in ubuntu it comes fine. I am working with…
Qmr
  • 64
  • 1
  • 7
0
votes
2 answers

Rails: Easiest way to provide file downloads?

G'day guys, currently have almost finished writing a rails application that allows a CSV download of the database. This is generated when the index is first viewed. Is there an easy way to insert a link to a helper that returns a CSV document? That…
Schroedinger
  • 1,273
  • 14
  • 32
0
votes
2 answers

How do I merge two CSV's with nearly identical sets using rules for which data is kept? (Using Ruby & FasterCSV)

I have two csv files, each with 13 columns. The first column of each row contains a unique string. Some are duplicated in each file, some only exist in one file. If the row exists in only one file I want to keep it in the new file. If it exists in…
daveaseeman
  • 165
  • 1
  • 9
0
votes
2 answers

fastercsv parsing to int or other into ActiveRecord

I'm currently importing a CSV into an activerecord element but can't choose to parse the elements as say ints or decimals on a case by case basis using fastercsv. I can either choose to parse everything as an int or the other, or all as strings. I…
Schroedinger
  • 1,273
  • 14
  • 32
0
votes
2 answers

Ruby on Rails export to csv - maintain mysql select statement order

Exporting some data from mysql to a csv file using FasterCSV. I'd like the columns in the outputted CSV to be in the same order as the select statement in my query. Example: rows = Data.find( :all, :select=>'name, age, height,…
user301410
  • 87
  • 2
  • 5
0
votes
1 answer

Line/Row separator/delimiter in exported CSV using Ruby CSV

Is it possible to change the default line separator from newline '\n' or '\r\n' to some other character, e.g '|' while importing. I know this seems foolish. But i have multiple records in csv file with column address and some addresses might contain…
Pandya M. Nandan
  • 653
  • 2
  • 9
  • 21
0
votes
1 answer

Trying to do a CSV to multiple tables import with FasterCSV

I have a fasterCSV rake script but it only imports to 1 table. I am importing products and the products have several pieces of info stored on other tables. Current script: http://gist.github.com/321889 What I need to add is some way to import…
TJ Sherrill
  • 2,465
  • 7
  • 50
  • 88
0
votes
1 answer

How to add dropdown button into Csv file during exportation

I need to Add dropdown button for each row in csv export file i am using Fastercsv gem for csv exportation and my code is csv_string = FasterCSV.generate({:col_sep => "\t"}) do |csv| csv << ["admission_no","first_name","last_name","dob"] …
Hemanth M C
  • 436
  • 1
  • 4
  • 18
0
votes
1 answer

Exporting large amounts of data using FasterCSV with Rails

I have a controller in Rails that generates CSV reports using FasterCSV. These reports will contain approximately 20,000 rows, maybe more. It takes about 30 seconds or more when creating the csv_string in my implementation below. Is there a…
Trevor
  • 6,659
  • 5
  • 35
  • 68
0
votes
1 answer

how to pass unknown number of arguments to a function in R programming

I am parsing a csv with multiple columns. The number of columns is not fixed in the csv file. It varies from 5 to 10. I need to recreate a data.frame with these columns inside a function. I am wondering if there is any multiple arguments…
JstRoRR
  • 3,693
  • 2
  • 19
  • 20
0
votes
2 answers

Ruby on Rails Moving from CSV to FasterCSV

I currently have the following code to parse a csv file using the standard csv library @parsed_file=CSV::Reader.parse(params[:dump][:file]) @parsed_file.each do |row| #some code end I want to move this to faster csv for the increased speed. Does…
Splashlin
  • 7,225
  • 12
  • 46
  • 50
0
votes
1 answer

Large CSV manipulation

I have a very large CSV file (over 100 million records) that I would like to delete several columns from. I have tried the application CSVed (http://csved.sjfrancke.nl/#csvuni) but a file this size will not open. Does anybody know what I would…
0
votes
1 answer

set column width while generating CSV using fastercsv

I am using FasterCSV.generate method to generate csv. I want to set width to each column generated in csv. How can I do that?
unnati patil
  • 1,601
  • 2
  • 13
  • 12
0
votes
1 answer

How to create multiple CSV file by using FasterCSV in Ruby

I am very new to ruby. I have a question that how can I export two files within one click. In the exsiting version, I can generate only one file at a time by calling 'def stream_csv', but when I try to call it twice in order to get two files, I got…
Fon
  • 299
  • 1
  • 3
  • 16
0
votes
1 answer

How does FasterCSV determine whether or not to add quote?

When I try to output some data into a text file using FasterCSV, sometimes it adds the quotes to the concatenated string and sometimes it does not. For instance: FasterCSV.generate do |csv| csv << ["E"+company_code] csv <<…
X2theZ
  • 278
  • 4
  • 16