jeudi 5 novembre 2015

How to change headers of a CSV file using Ruby

I am trying to change the headers of a CSV file using a ruby script, however I am only able to change the rows of data, and not the headers. I have tried looking at other examples, however they did not work. I have been looking at some of the Ruby documentation here, however it is still no working. Here is how I ma trying to do it right now:

input = TestFile, 'r' #read
output = TestFile, 'w' #write
CSV.filter input, output, :headers => true, :write_headers => true, :return_headers => true do |csv|
  csv << ["Test"] if row.header_row?

Aucun commentaire:

Enregistrer un commentaire