Skip to content

Instantly share code, notes, and snippets.

@andycamp
Last active January 1, 2016 17:59
Show Gist options
  • Select an option

  • Save andycamp/8180944 to your computer and use it in GitHub Desktop.

Select an option

Save andycamp/8180944 to your computer and use it in GitHub Desktop.
Ruby CSV append
require 'csv'
CSV.open("test.csv", "w", :col_sep => "\t") do |csv|
csv << ["one", "two", "three"]
csv << [1, 2, 3]
csv << [1, 2, 3]
csv << [1, 2, 3]
end
CSV.open("test.csv", "ab", :col_sep => "\t") do |csv|
csv << [4, 5, 6]
csv << [4, 5, 6]
csv << [4, 5, 6]
csv << [4, 5, 6]
csv << [4, 5, 6]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment