in my previous blog post, i briefly talked about syncing an android phone with icloud instead of google contacts. in this post, i’ll talk a little bit about cleaning up your google contacts.
so if you’re like me, you may not be quite ready to erase everything from google contacts (because the implicit result of this is that you will lose google chat access to these people (unless you request permission to chat with them again), and i believe you may also break google plus connections, but i am not certain about that one).
rather than cleaning up manually (which could take a long time, depending on the number of contacts you have), here is a way to start the clean up process.
- download googlecl. this open source project allows you to send commands to certain google services from the command line.
- download the gdata-python-client library. this is required to run googlecl.
- install both (untar, then
sudo python setup.py installon both).
now validate that it works - a good test would be running
google contacts list ahmed, to list any ahmeds you have in your contacts. this should open up a browser the first time to ask you to authenticate googlecl to use your account info.
now that we’re validated and authenticated, we can start doing things like this:
the first part enumerates A-Z (got that bit from stackoverflow) - so for each character between A and Z, get all the names, emails, and phone numbers of my contacts. note that this causes certain records to appear many times, and i am not sure if there’s a better way to do this - perhaps just looping on a, e, i, o, u would suffice, but i am not sure.
now, you can do things like this:
and there you have it. eventually, i’ll remove everyone from google contacts, but for now, this greatly reduces the number of people in google contacts that don’t need to be there.
that’s all for now!