SEARCH

How-To Geek

Access Google Services From the Command Line

Want to show your geeky side and edit your Google Docs or write a Blogger post from command prompt?  Here’s how you can access a variety of Google services from command line with the GoogleCL.

Getting Started

GoogleCL is a Python command line application that lets you access various Google services from command line on Windows, Mac OS X, or Linux.  Here we’ll be using the Windows version on Windows 7, but it would work the exact same on other platforms.

Head over to the download link below, and select the correct version for your OS.  If you want to run it on Windows, select the zip file.  Ubuntu users can download and install the .deb file.

sshot-2010-07-27-[08-22-30]

After downloading the zip file for Windows, extract it as normal and then run the google.exe program in the folder.

sshot-2010-07-27-[08-25-11]

The first time you run Google CL, it will create a preferences folder at:

%USERPROFILE%\.googlecl

sshot-2010-07-27-[20-53-58]

On one of our tests, we received an error saying that MSVCR71.dll was missing from our computer, so GoogleCL couldn’t run.  This is a C++ runtime library in Windows, and most programs that need it include it with their program files.  GoogleCL does not include this DLL in the zip file, so we’ll need to find a copy for it.

image

You’ll likely have many copies of this file throughout your computer, but GoogleCL cannot find them.  So, do a computer-wide search for msvcr71.dll, and copy one of these files it finds.

image

Now paste that dll file in the GoogleCL folder, and run google.exe as before.  Everything should work perfectly this time.

image

Using GoogleCL

GoogleCL’s syntax is very easy to use and understand.  To get started, you might want to checkout the readme.txt file included.  Or, just type help at the prompt to get some quick instructions.

image

You can use GoogleCL to access services on Picasa, Blogger, YouTube, Docs, Contacts, and Calendar via the command line interface, and we’d love to see future versions will include support for more items including Gmail and Search.  For now, though, these services are still useful.  Enter help followed by a service name to see more info about it and some usage examples.  Here we see the help for Calendar.

image

Activating a Service

When you first use a service, you’ll have to activate your computer with it online.  For instance, if we wanted to see all the appointments in our Calendar, we’d enter Calendar list.  You’ll be asked to specify a user; enter your Gmail email address.  Then, you’ll be prompted to approve the access in your browser, and the approval page will automatically open in your default browser.

sshot-2010-07-27-[15-45-24]

Click Grant access in the webpage that opens, and then press Enter in the GoogleCL window.

image

You’ll have to do this for each of the Google services you use.  Even closely related services like Contacts and Calendar have to be activated individually.  One interesting aspect of this is that you could have different Google account associated with different services.  Once they’re activated, though, it’ll be easy to use these services on this computer.

Using GoogleCL

GoogleCL has tons of functions you can use to interact with Google’s services.  We’ll look at a few of the functions we found interesting.

Docs

First, we tried uploading a document to Docs.  To do this, enter:

docs upload path_to_your_document

This may take a minute depending on the size of your document, but once it’s done, you’ll see a success message and a link to your document.

image

You’re supposed to be able to edit documents by entering:

docs edit –title “your_document” –editor your_editor

However, this didn’t work in our tests, and we received an error message.  This should work in the future, and could have been caused by a problem on our end, but it would not work in any of our tests.

image

YouTube

GoogleCL worked great for uploading videos to YouTube.  Once you’ve authorized your account, enter:

youtube post “your_file_path

Enter a category name when requested, and GoogleCL will start uploading your video to YouTube.  As usual, this will take a few minutes depending on the size of your video, but it’s still quicker than going to the YouTube page to post a video.

image

Note that you may see an error if you enter a category that is not available on YouTube.  If so, try again, this time entering a correct category.

image

For your reference, here’s some of the categories you can use from YouTube.com…so make sure you use one of them.

sshot-2010-07-27-[16-29-34]

Blogger

GoogleCL makes Blogger into a geekier blogging service.  You can review, tag and even create new posts on Blogger, all directly from command line.  You can write the body of your post in a text file, and you can even use HTML markup to make the post look like you want.  To do this, enter the following in GoogleCL:

blogger post –title “your_titlepath_to_post_file

sshot-2010-07-27-[20-32-37]

Moments later, we had a new blog post with the content from our text file.  We could have posted a long, well formatted HTML post, but hey, what’s better than the classic geek greeting for a geeky blog post?

image

Conclusion

Whether you’d like to quickly edit Gmail contact info, upload a YouTube video without using the flaky Flash uploader, or make a script that automatically makes a post on Blogger when you bang your head on the keyboard, GoogleCL gives you the tools you need to do more with Google than you though possible.  Who said Google doesn’t have a cloud OS?  When you can interact with a webapp via command prompt, suddenly it feels like Google is just another part of your computer.  We’ve only scratched the surface of what you can do with GoogleCL; check out the examples link below for more ideas.  Let us know what geeky projects you do with GoogleCL!

Link

Download GoogleCL

Check out Example GoogleCL Scripts

Matthew digs up tasty bytes about Windows, Virtualization, and the cloud, and serves them up for all to enjoy!

  • Published 07/28/10

Comments (1)

  1. hkQQ2010

    It’s great !

    I hope I can read over all the articles here.
    And …. I hope I can memorize them all ….
    hehe … heee heee … almost an impossible hope ….

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!