# Fastercsv: row\["header1"\] syntax doesn't work, why?

**URL:** <https://www.ruby-forum.com/t/fastercsv-row-header1-syntax-doesnt-work-why/119296>\
**Category:** Ruby\
**Created:** [November 5, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/fastercsv-row-header1-syntax-doesnt-work-why/119296 "2007-11-05T21:37:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![7stud](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/7/57b2e6/32.png) [@7stud](https://www.ruby-forum.com/u/7stud)\
**Post date:** [November 5, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/fastercsv-row-header1-syntax-doesnt-work-why/119296/1 "2007-11-05T21:37:52Z")

</div>

$ cat data.csv  
name number  
me 12  
you 20

require ‘rubygems’  
require ‘fastercsv’

FasterCSV.foreach(“data.csv”, :headers =\>true, :col\_sep =\>’\t’) do |row|  
puts row  
puts row[‘name’]  
puts row[‘number’]  
puts row.class  
end

–output:–  
me 12  
nil  
nil  
FasterCSV::Row  
you 20  
nil  
nil  
FasterCSV::Row

I’ve sifted through the docs, and I can’t find any indication why the  
row[‘name’] syntax won’t work.

---

<div class="post-metadata">

**Author:** ![7stud](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/7/57b2e6/32.png) [@7stud](https://www.ruby-forum.com/u/7stud)\
**Post date:** [November 5, 2007, 9:55pm UTC](https://www.ruby-forum.com/t/fastercsv-row-header1-syntax-doesnt-work-why/119296/2 "2007-11-05T21:55:34Z")

</div>

7stud – wrote:

> $ cat data.csv  
> name number  
> me 12  
> you 20
> 
> I’ve sifted through the docs, and I can’t find any indication why the  
> row[‘name’] syntax won’t work.

Arrrgh. vim was turning my tabs into spaces, so the ‘\t’ separator  
wasn’t in the data.csv file. This works:

$ cat data.csv  
name,number  
me,12  
you,20

* * *

FasterCSV.foreach(“data.csv”, :headers =\>true) do |row|  
puts row  
puts row[‘name’]  
puts row[‘number’]  
puts row.class  
end

–output:–  
me,12  
me  
12  
FasterCSV::Row  
you,20  
you  
20
