# Csv header -mapping

**URL:** <https://www.ruby-forum.com/t/csv-header-mapping/187784>\
**Category:** Rails\
**Created:** [April 29, 2010, 8:03am UTC](https://www.ruby-forum.com/t/csv-header-mapping/187784 "2010-04-29T08:03:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![savitha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@savitha](https://www.ruby-forum.com/u/savitha)\
**Post date:** [April 29, 2010, 8:03am UTC](https://www.ruby-forum.com/t/csv-header-mapping/187784/1 "2010-04-29T08:03:57Z")

</div>

Hi all,

I need to append the headers to specific attributes within a form from  
an imported csv file, for example; I have a model which contain only  
“:name” field but csv file contain firstname and last name (csv files  
are submitted by user ,so there is no control over file format ) CSV  
file may look like  
FirstName,Lastname  
smith,paul  
how can i drag the fields from the csv file into the correct column for  
(:name as example you could drag the fields of firstname and lastname  
and append them both to name),how user can select each header from a  
column and attach the header to the form field… is there any javascript  
to do this… if so can anyone share some links to get an idea

Thank u
