Skip to content

Instantly share code, notes, and snippets.

Created May 1, 2012 15:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Cheerleader CSV Parser
# This script assumes there is a folder named ./emails for the content to go into
require 'csv'
#load the cheerleaders
file ="team.csv")
print file.class
cheerleaders = []
for i in 1..(file.length - 1)
cheerleaderInfo = {}
column = 0
for header in file[0]
cheerleaderInfo[header] = file[i][column]
column += 1
cheerleaders[i-1] = cheerleaderInfo
for cheerleader in cheerleaders
msg = cheerleader["Email "] + "\n\n"
filename = cheerleader["First Name"] + cheerleader["Last Name"] + ".txt" "emails/"+filename, "w" ) do |the_file|
the_file.puts msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment