Пример #1
0
  public ImportClient(String username, String password, int itemsPerBatch, String spreadsheetName)
      throws Exception {
    ITEMS_PER_BATCH = itemsPerBatch;

    factory = FeedURLFactory.getDefault();
    service = new SpreadsheetService("Props-2-Xls");
    service.setUserCredentials(username, password);
    service.setProtocolVersion(
        SpreadsheetService.Versions
            .V1); // bug workaround! http://code.google.com/p/gdata-java-client/issues/detail?id=103

    spreadsheet = getSpreadsheet(spreadsheetName);
    backingEntry = spreadsheet.getDefaultWorksheet();

    CellQuery cellQuery = new CellQuery(backingEntry.getCellFeedUrl());
    cellQuery.setReturnEmpty(true);
    CellFeed cellFeed = service.getFeed(cellQuery, CellFeed.class);
  }
Пример #2
0
 /**
  * Constructs a cell demo from the specified spreadsheet service, which is used to authenticate to
  * and access Google Spreadsheets.
  *
  * @param service the connection to the Google Spradsheets service.
  * @param outputStream a handle for stdout.
  */
 public CellDemo(SpreadsheetService service, PrintStream outputStream) {
   this.service = service;
   this.out = outputStream;
   this.factory = FeedURLFactory.getDefault();
 }