Created
June 30, 2017 18:48
-
-
Save DanCoughlin/28f20bb50481c21eec60f175972ea366 to your computer and use it in GitHub Desktop.
Opening a CSV and parsing it out
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
require 'csv' | |
namespace :break_up_csv do | |
desc "take the OSP file and merge it with the active AI User accounts | |
to get a file (found.xls) that has OSP grant data with all user info | |
and another file (not_found.xls) that includes the OSP grant data that | |
doesn't have matching users" | |
task split_files: :environment do | |
puts "open data file." | |
grants = CSV.read('data/dmresults.csv', encoding: "UTF-8") | |
puts "Do something with first 30 rows" | |
puts grants[0..30] | |
puts "Do something with next 30 rows" | |
puts grants[31..60] | |
puts "done" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment