title: Appending text by column to the same row for a CSV file on Ruby 2.4
body: <p>I have a CSV file that contains headers and 1 row of data:</p>
  
  <p>I want to append data by the column name (the header) but to the same row (row number 1)</p>
  
  <p>I'm inserting each column data separately.</p>
  
  <p>So at the end, I will have a file that contains headers and 1 row of data</p>
  
  <p>for example:</p>
  
  <pre><code>header1,header2
  
  data1,data2 
  </code></pre>
  
  <p>I'm using </p>
  
  <pre><code> def insert_info_csv(header,values)
    headers=['1', '2', '3', '4']
    file='report_test.csv'
  
    CSV.open('report_test.csv','a') do |csv|
      row=CSV::Row.new(headers,[])
      row[header]=values (where I insert the data)
      csv &lt;&lt; row
    end
    end
  </code></pre>
  
  <p>my issue is that each data is written in a different row for example:</p>
  
  <pre><code> Header1, header2
  
   data1,
  
         ,data2
  </code></pre>
  
  <p>Thank you for the help.</p>