Created
December 19, 2009 03:40
-
-
Save edgars/259934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org; | |
import java.net.URL; | |
import java.util.List; | |
import com.google.gdata.client.spreadsheet.*; | |
import com.google.gdata.data.*; | |
import com.google.gdata.data.spreadsheet.*; | |
import com.google.gdata.util.*; | |
public class Main { | |
/** | |
* @param args | |
* @throws Exception | |
*/ | |
public static void main(String[] args) throws Exception { | |
SpreadsheetService myService = new SpreadsheetService("JBossEsb-GoogleDocs-1"); | |
myService.setUserCredentials("jbossesb@facilitait.com.br", "#########"); | |
URL metafeedUrl = new URL("http://spreadsheets.google.com/feeds/spreadsheets/private/full"); | |
SpreadsheetFeed feed = myService.getFeed(metafeedUrl, SpreadsheetFeed.class); | |
List<SpreadsheetEntry> spreadsheets = feed.getEntries(); | |
SpreadsheetEntry entry = null ; | |
for (int i = 0; i < spreadsheets.size(); i++) { | |
entry = spreadsheets.get(i); | |
System.out.println("\t" + entry.getTitle().getPlainText()); | |
} | |
WorksheetEntry worksheet = null; | |
List<WorksheetEntry> worksheets = entry.getWorksheets(); | |
for (int j = 0; j < worksheets.size(); j++) { | |
worksheet = worksheets.get(j); | |
String title = worksheet.getTitle().getPlainText(); | |
int rowCount = worksheet.getRowCount(); | |
int colCount = worksheet.getColCount(); | |
System.out.println("\t" + title + "- rows:" + rowCount + " cols: " + colCount); | |
} | |
URL listFeedUrl = worksheet.getListFeedUrl(); | |
ListFeed listFeed = myService.getFeed(listFeedUrl, ListFeed.class); | |
for (ListEntry entrada : listFeed.getEntries()) { | |
System.out.println(entrada.getTitle().getPlainText()); | |
for (String tag : entrada.getCustomElements().getTags()) { | |
System.out.println(" <gsx:" + tag + ">" + | |
entrada.getCustomElements().getValue(tag) + "</gsx:" + tag + ">"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment