Skip to content

Instantly share code, notes, and snippets.

@cgrusden
Created November 13, 2014 23:32
Show Gist options
  • Save cgrusden/03357d5cae4cb59f973d to your computer and use it in GitHub Desktop.
Save cgrusden/03357d5cae4cb59f973d to your computer and use it in GitHub Desktop.
Filter your Google Contacts QUICK
# Steps to clean up your google contacts:
# Read to know how to Export your contacts to Google CSV format: https://support.google.com/mail/answer/24911?hl=en
# Download those contacts to ~/contacts/google.csv
# Put this code into ~/contacts/parser.rb
# Change to that directory: $ cd ~/contacts/parser.rb
# Run the parser: $ ruby parser.rb
# Hit k <enter> to KEEP that contact in your new clean list
# Hit <enter> to PASS on keeping that contact in your new clean list
# Once all the way through, copy the header-line (the first line of google.csv) into your new clean_contacts.csv
# Go back to Google, import this into your contacts (it will not remove any of your contacts, it will create a new Contacts group
# with the name of todays date. example: Imported Contacts 10/10/2014
# Rename the New Group you just imported to something else.
# now you can send emails to that group
require 'csv'
CSV.open("clean_contacts.csv", "wb") do |new_csv|
CSV.foreach("google.csv", headers: true) do |row|
puts "#{row['Name']}, #{row['E-mail 1 - Value']}"
answer = gets.chomp
if answer == 'k'
new_csv << row
puts 'Noted!, next!'
else
puts 'passing!'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment