Monday, June 20, 2011

Google Apps Scripts: Shared Contact Groups

UPDATE: Jul 7, 2012
While revising the script I did more debugging as there were some code chunks I wanted to improve, thinking that maybe Apps script performance got better. It turns out, creating a new or updating existing contact is very inefficient. Here's a screenshot from my debugging session:

Notice a bunch of cc.setXxx() methods. From my understanding every setXxx() call (e.g. setFamilyName) actually does a real API call to Google Contacts backend, so you can imagine how many API calls the script does only to update or create one contact. I suspect Google (reasonably) sets an API call rate threshold which is probably what limits the synchronization process and "We're sorry, a server error occurred. Please try again".

A much more efficient approach would be to create or update a contact data in one API call, e.g. ContactsApp.createContact(...all fields go here...).

Another efficient approach would be to update all fields without making actual Contacts API calls and only afterwords do one API call e.g. ContactsApp.updateContact(contact_object).

Unfortunately, there are no efficient approaches currently available. At least, I could not dig it up from Apps script documentation. This leaves the script to be quite inefficient as there is no way to do "batch updates", especially with a medium to large contact groups. Well, it is possible to use directly Google Contacts API protocol (GData) from Apps script, but App Engine would probably be a better platform to do the job.

ORIGINAL POST (Jun 20, 2011)

This is a simple Apps script to share a group of contacts among some users within your Google Apps domain or just any user with a Google account, if you don't want to buy an app from Google Apps Marketpalce.

Here's how to use it.

1. Create a new spreadsheet, go to Tools > Script Gallery, search for "shared contact groups" and click on "install" button. If you can't find it just download this text file and paste its content into the script editor window:

2. After you install the script you should be able to see an additional menu called "Contacts". Use it to start sharing an existing group of your contacts:

Select a group you want to share and click on "continue"

3. The script will create a new sheet named after the contacts group and populate it with contacts of that group:

4. That's it. Now, share the spreadsheet with someone else and tell them to go Contacts > Sync with my contacts:

5. Keep it synchronized! Go to
Tools > Script editor and then Triggers > Current script's triggers:

Now, add a time-driven trigger keep the contacts in sync with other users you've shared the spreadsheet with:

Let me know if you have any troubles.

Saturday, November 20, 2010

Hiring at Cloudware it!

Since June I kinda put on hold for some personal reasons but it is time for this cloud to come out and fly into the sky, and I have a feeling it's gonna fly real high.

I'm happy to announce that we've just started hiring people. We're looking for skilled (or not-so-skilled but eager to learn) developers to work with platforms like Google App Engine, Amazon Web Services and Google Apps leveraging all their power through APIs; document-based DBs; frameworks like GWT and Ruby on Rails.

I hear you saying already, "Hey, where did 'mobile' part go?" - it is there, of course. We're primarily focusing on Android and iPhone platforms but Web interface in HTML5 is as much important.

We don't expect anyone to be a top expert in all the areas. What's more important is a highly motivated personality. We seriously consider every application.

A lot of fun now, isn't!?
Official info is on this page: Jobs @ Cloudware it!