import com.google.gdata.client.spreadsheet.*;
import com.google.gdata.data.spreadsheet.*;
import com.google.gdata.util.*;
import java.io.IOException;
import java.net.URL;
import java.util.List;
public class Interact
{
public static void main(String args[]) throws IOException, ServiceException
{
SpreadsheetService myService = new SpreadsheetService("exampleCo-exampleApp-1");
myService.setUserCredentials("username", "password");
// SpreadSheets Feed URL
URL metafeedUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full");
// Obtaining the SpreadSheet Feed
SpreadsheetFeed feed = myService.getFeed(metafeedUrl, SpreadsheetFeed.class);
List
// Obtaining that particular SpreadSheet...
SpreadsheetEntry entry = spreadsheets.get(10);
/* First obtain the list feed URL from a WorksheetEntry and request
this feed from our authenticated SpreadsheetService object.
The SpreadsheetServicereturns a ListFeed, which contains a list
of all the rows in this worksheet. Each row is represented as
a ListEntry object.*/
// Create a list of all the Worksheets
List
// Retreive the first Worksheet
WorksheetEntry worksheet = worksheets.get(0);
// Retrieve List Feed URL
URL listFeedUrl = worksheet.getListFeedUrl();
// Get Feed from the ListFeedURL
ListFeed listfeed = myService.getFeed(listFeedUrl, ListFeed.class);
// Examine Each List Entry from the ListFeed obtained
for (ListEntry listEntry : listfeed.getEntries()) {
System.out.println(listEntry.getCustomElements().getValue("mobile"));
}
}
}
No comments:
Post a Comment