Quantcast
Channel: upload
Viewing all articles
Browse latest Browse all 11

Terminal 101: Using Google Docs through Terminal

0
0

Every Monday, we'll show you how to do something new and simple with Apple's built-in command line application. You don't need any fancy software, or a knowledge of coding to do any of these. All you need is a keyboard to type 'em out!

Welcome to the last of our series of posts about Google's Command Line Tools (next week, we'll continue our regular series of Terminal 101s). For this final post, we wanted to show you how to use Google Docs from the command line. Google Docs is a great service that lets you stow all of your documents in the cloud, and even edit documents like Word, Excel, and PowerPoint documents. In this Terminal 101, we'll show you how to download, edit, upload, and delete your documents stored in this Google service. Let's get started.

Note: If you haven't already done so, follow our guide from last month to set up your Mac to enable Terminal to talk with Google's services. The guide can be found here.

Listing and Downloading Documents

Before we get to downloading the documents, let's list them so we know what we've got stored in Google Docs. To list your items, type the following command, followed by the enter key on your keyboard:

google docs list

Note that if this is your first time using Google Docs through the command line, you may be required to authenticate with the Google servers.


Now that you can see what you have stored in your account, you can download an item by typing the following command:

google docs get --title "title here"

Replace "title here" with the title of the document that you wish to download. You will be asked to enter the destination of the file. Here, enter the filename, followed by a dot and the file format. In our instance, we were downloading an Excel spreadsheet, so we entered "Name.xls".

Editing Documents

You can edit documents that are stored in Google Docs right from the command line. To do this, you'll type in the following command followed by the enter key:

google docs edit --title "Forsquare Check-ins" --editor nano

For more information about using the nano editor, check out our previous Terminal 101 on editing documents with nano.



When you exit nano, and write in the changes, then Google CLI will automatically upload them to the document stored inside of your Google Docs/Drive Account.

Uploading Documents

In addition to simply editing the documents that are stored in your Google Docs account, you can also upload existing documents into your online account. To do this, simply issue the following command:

google docs upload File.extension

Replace "File.extension" with the path and filename of the document (or other supported file) that you wish to upload to Google Docs. After you press enter, your document will be uploaded, and you will be provided a link to access the file in a web browser.

Deleting Unwanted Documents

Deleting documents is the same as other Google services that support the Google CLI. To delete a document, replace the title string in this command:

google docs delete --title "Title here"

After doing this, you'll be prompted to reply y (yes) or N (no) as to whether or not you wish to delete the document.

Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article's author on Twitter.


Viewing all articles
Browse latest Browse all 11

Latest Images

Trending Articles





Latest Images