Cheerleader CSV Parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Users/zacharyc/.rvm/rubies/ruby-1.9.2-head/bin/ruby | |
# This script assumes there is a folder named ./emails for the content to go into | |
require 'csv' | |
#load the cheerleaders | |
file = CSV.read("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 | |
end | |
cheerleaders[i-1] = cheerleaderInfo | |
end | |
for cheerleader in cheerleaders | |
msg = cheerleader["Email "] + "\n\n" | |
filename = cheerleader["First Name"] + cheerleader["Last Name"] + ".txt" | |
File.open( "emails/"+filename, "w" ) do |the_file| | |
the_file.puts msg | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment