You can connect and retrieve data from any of the Google services by using Google API. Here we
are going to use one such application for retrieving list of documents from Google Docs using the java client library provides by Google. You can download that open source stuffs latest version from gdata-java-client. The steps for installing the library and its dependencies to your local system can be found in "Getting started with Google Data java Client Library".
If you are using eclipse IDE for working with Java, then the steps of installation are more easy and that can be found in "Coding in the Shade". After successfully installing those libraries and contents. Now we can start developing our first and simple application to retrieve the document list from Google Docs.
Now Create a java project and add the necessary External jars to project library. As we are going to develop a application to communicate with Google Docs add the "gdata-docs-3.0.jar" and "gdata-docs-meta-3.0.jar" in specific for this project.
Download full Code here
In the downloaded code you can find the import statements, which imports three important class to get feeds from Google Docs.

If you are using eclipse IDE for working with Java, then the steps of installation are more easy and that can be found in "Coding in the Shade". After successfully installing those libraries and contents. Now we can start developing our first and simple application to retrieve the document list from Google Docs.
Now Create a java project and add the necessary External jars to project library. As we are going to develop a application to communicate with Google Docs add the "gdata-docs-3.0.jar" and "gdata-docs-meta-3.0.jar" in specific for this project.
Download full Code here
In the downloaded code you can find the import statements, which imports three important class to get feeds from Google Docs.
import com.google.gdata.client.docs.DocsService;
import com.google.gdata.data.docs.DocumentListEntry;
import com.google.gdata.data.docs.DocumentListFeed;
First instance for the DocsSrevice class is created by passing the applications information as parameters to the constructor. And the users credentials such as username with domain name and corresponding password are set using the setUserCredentials() method.
DocsService client = new DocsService("yourCo-yourAppName-v1");
client.setUserCredentials("UrEmailID@gmail.com","Password");
Then the getFeed() method of DocsService class is invoked, the url from which the feeds are to be obtained are passed as the argument. The feeds obtained by getFeed() is assigned to instance of DocumentListFeed. Each entry in the feed are extracted using the DocumentListEntry class.
URL feedUri = new URL("http://docs.google.com/feeds/default/private/full/");
DocumentListFeed feed = (DocumentListFeed) client.getFeed(feedUri, DocumentListFeed.class);
for (DocumentListEntry entry : feed.getEntries()) {
printEntry(entry);
}
Then each documents information be obtained as follows:
public void printEntry(DocumentListEntry entry) {
String resourceId = entry.getResourceId();
String docType = entry.getType();
System.out.println("'" + entry.getTitle().getPlainText() + "' (" + docType + ")");
System.out.println(" link to Google Docs: " + entry.getDocumentLink().getHref());
System.out.println(" resource id: " + resourceId);
System.out.println(" doc id: " + entry.getDocId());
}
This is a initiation, you can process a lot more using those API. To get more information about working with Google Docs you can check the following links:
- Google Document List Data API
- Google Document API Developers Guide
- Google Document Client Libraries and Sample Code