# Faster csv issue

**URL:** <https://rubytalk.org/t/faster-csv-issue/46924>\
**Category:** ruby-talk\
**Created:** [4 June 2008 21:49 UTC](https://rubytalk.org/t/faster-csv-issue/46924 "2008-06-04T21:49:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@Junkone](https://rubytalk.org/u/Junkone)\
**Post date:** [4 June 2008 21:49 UTC](https://rubytalk.org/t/faster-csv-issue/46924/1 "2008-06-04T21:49:08Z")

</div>

not sure why fastercsv cannot parse this. cannot find anything wrong  
with my code either. why does it show invalid arguement. for eg

puts ie.text  
"ClientAccountID","CurrencyPrimary","AssetClass","Symbol","OptionFutureCode","Quantity","MarkPrice","CostBasisPrice"

"6814789","USD","STK","CSUN","","125","11.9800","12.1750"

"6814789","USD","STK","SIMO","","150","20.0500","19.186667"  
arr\_of\_arrs = FasterCSV.read(ie.text,{:col\_sep =\> ",",:headers=\>true})  
Invalid argument -  
"ClientAccountID","CurrencyPrimary","AssetClass","Symbol","OptionFutureCode","Quantity","MarkPrice","CostBasisPrice"

"6814789","USD","STK","CSUN","","125","11.9800","12.1750"

"6814789","USD","STK","SIMO","","150","20.0500","19.186667"

---

<div class="post-metadata">

**Author:** ![James\_Edward\_Gray\_II](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@James\_Edward\_Gray\_II](https://rubytalk.org/u/James_Edward_Gray_II)\
**Post date:** [4 June 2008 22:06 UTC](https://rubytalk.org/t/faster-csv-issue/46924/2 "2008-06-04T22:06:47Z")

</div>

I don't see the "Invalid Argument error here, but you should be using parse() instead of read(), if the content comes from a String:

#!/usr/bin/env ruby -wKU

require "rubygems"  
require "faster\_csv"

csv = \<\<END\_CSV  
"ClientAccountID","CurrencyPrimary","AssetClass","Symbol","OptionFutureCode","Quantity","MarkPrice","CostBasisPrice"  
"6814789","USD","STK","CSUN","","125","11.9800","12.1750"  
"6814789","USD","STK","SIMO","","150","20.0500","19.186667"  
END\_CSV

p FCSV.parse(csv, :col\_sep =\> ",", :headers =\> true)

\_\_END\_\_

Hope that helps.

James Edward Gray II

> **···**
>
> On Jun 4, 2008, at 4:49 PM, Junkone wrote:
> 
> > not sure why fastercsv cannot parse this. cannot find anything wrong  
> > with my code either. why does it show invalid arguement.

---

<div class="post-metadata">

**Author:** ![Junkone](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@Junkone](https://rubytalk.org/u/Junkone)\
**Post date:** [5 June 2008 17:29 UTC](https://rubytalk.org/t/faster-csv-issue/46924/3 "2008-06-05T17:29:02Z")

</div>

thanks james.

> **···**
>
> On Jun 4, 6:06 pm, James Gray \<ja...@grayproductions.net\> wrote:
> 
> > On Jun 4, 2008, at 4:49 PM, Junkone wrote:
> > 
> > \> not sure why fastercsv cannot parse this. cannot find anything wrong  
> > \> with my code either. why does it show invalid arguement.
> > 
> > I don't see the "Invalid Argument error here, but you should be using  
> > parse() instead of read(), if the content comes from a String:
> > 
> > #!/usr/bin/env ruby -wKU
> > 
> > require "rubygems"  
> > require "faster\_csv"
> > 
> > csv = \<\<END\_CSV  
> > "ClientAccountID  
> > ","CurrencyPrimary  
> > ","AssetClass  
> > ","Symbol","OptionFutureCode","Quantity","MarkPrice","CostBasisPrice"  
> > "6814789","USD","STK","CSUN","","125","11.9800","12.1750"  
> > "6814789","USD","STK","SIMO","","150","20.0500","19.186667"  
> > END\_CSV
> > 
> > p FCSV.parse(csv, :col\_sep =\> ",", :headers =\> true)
> > 
> > \_\_END\_\_
> > 
> > Hope that helps.
> > 
> > James Edward Gray II
