Purpose: Creates a Gmail filter to exclude (whitelist) contacts from a Google contacts CSV file
Author: Matthew Renze
Usage: python.exe CreateFilter.py input-file
- input-file - the Google Contacts CSV file to filter
Example: python.exe CreateFilter.py C:\Contacts.csv
Instructions:
- Go to https://www.google.com/contacts
- Select the contact to be included in the filter
- In the "More" dropdown list, select "Export"
- Select the Outlook CSV format (NOT Google CSV format)
- Click Export
- Run the script on the CSV file (as described above)
- Copy the output to your clipboard
- Go to https://mail.google.com/mail/u/1/#settings/filters
- Create a new filter
- Paste the filter string into the "Doesn't have" field
- Finish creating the filter
Now the selected email addresses will be excluded from the filter
Notes:
- Works only with Outlook CSV format export from Google Contacts. Unfortunately, the Google CSV format files had a weird encoding and couldn't be read as CSV
- Google imposes a maximum size limit to the filter strings, so if you have too many contacts, this won't work. Try deselecting contacts until it does.