Package com.google.gdata.data.spreadsheet

Examples of com.google.gdata.data.spreadsheet.WorksheetEntry


        SpreadsheetFeed feed = service.getFeed(url, SpreadsheetFeed.class);
        List<SpreadsheetEntry> spreadsheets = feed.getEntries();
        SpreadsheetEntry spreadsheet = spreadsheets.get(0);
        WorksheetFeed worksheetFeed = service.getFeed(spreadsheet.getWorksheetFeedUrl(), WorksheetFeed.class);
        List<WorksheetEntry> worksheets = worksheetFeed.getEntries();
        WorksheetEntry worksheet = worksheets.get(0);
        // fetch A1 only
        URL cellFeedUrl = new URI(worksheet.getCellFeedUrl().toString() + "?min-row=1&max-row=1&min-col=1&max-col=1")
            .toURL();
        CellFeed cellFeed = service.getFeed(cellFeedUrl, CellFeed.class);
        // Iterate through each cell, printing its value.
        String onSupport = cellFeed.getEntries().get(0).getCell().getValue();
        return onSupport;
View Full Code Here


  }
 
  public GSpreadResultSet retrieveData() throws Exception {
    URL worksheetUrl = new URL(this.getConfig().generateWorksheetFeedURL());
    WorksheetFeed feedw = this.getConfig().getFeed(worksheetUrl, WorksheetFeed.class);
    WorksheetEntry worksheetEntry = feedw.getEntries().get(this.getWorksheetNumber() - 1);     
    CellFeed feedc = this.getConfig().getFeed(worksheetEntry.getCellFeedUrl(), CellFeed.class);     
    List<CellEntry> entries = feedc.getEntries();     
    GSpreadResultSet grs = new GSpreadResultSet();
   
    /* store the data */
    for (CellEntry entry : entries) {
View Full Code Here

          wsEntry.update();
          break;
        }
      }
      URL wsFeedUrl = spEntry.getWorksheetFeedUrl();
      WorksheetEntry wsEntry = null;
      if (spEntry != null) {
        if (findWorksheetEntry(ChartTypes.DAY, spEntry) == null) {
          wsEntry = new WorksheetEntry();
          wsEntry.setRowCount(365);
          wsEntry.setColCount(20);
          wsEntry.setTitle(new PlainTextConstruct(ChartTypes.DAY));
          spreadsheetService.insert(wsFeedUrl, wsEntry);
          Thread.sleep(gdataThreadSleep);
        }
        if (findWorksheetEntry(ChartTypes.MONTH, spEntry) == null) {
          wsEntry = new WorksheetEntry();
          wsEntry.setRowCount(12);
          wsEntry.setColCount(20);
          wsEntry.setTitle(new PlainTextConstruct(ChartTypes.MONTH));
          spreadsheetService.insert(wsFeedUrl, wsEntry);
          Thread.sleep(gdataThreadSleep);
        }
        if (findWorksheetEntry(ChartTypes.YEAR, spEntry) == null) {
          wsEntry = new WorksheetEntry();
          wsEntry.setRowCount(10);
          wsEntry.setColCount(20);
          wsEntry.setTitle(new PlainTextConstruct(ChartTypes.YEAR));
          spreadsheetService.insert(wsFeedUrl, wsEntry);
          Thread.sleep(2500);
        }
      }
    } catch (IOException e) {
View Full Code Here

  public void initStatSpreadSheet(String title) {
    try {
      SpreadsheetEntry spEntry = findSpreadsheetEntry(title);
      if (spEntry != null) {
        WorksheetEntry wsEntry = findWorksheetEntry(ChartTypes.DAY, spEntry);
        if (wsEntry != null) {
          initStatWorksheet(wsEntry, ChartTypes.DAY);
        }
        wsEntry = findWorksheetEntry(ChartTypes.MONTH, spEntry);
        if (wsEntry != null) {
View Full Code Here

        int limit,
        JSONObject options,
        List<Exception> exceptions) {
       
        try {
            WorksheetEntry worksheetEntry = service.getEntry(worksheetURL, WorksheetEntry.class);
            String spreadsheetName = docURL.toExternalForm();
            try {
                SpreadsheetEntry spreadsheetEntry = service.getEntry(docURL, SpreadsheetEntry.class);
                spreadsheetName = spreadsheetEntry.getTitle().getPlainText();
            } catch (ServiceException e) { // RedirectRequiredException among others
                // fall back to just using the URL (better for traceability anyway?)
            }
           
            String fileSource = spreadsheetName + " # " +
                worksheetEntry.getTitle().getPlainText();
           
            setProgress(job, fileSource, 0);
            TabularImportingParserBase.readTable(
                project,
                metadata,
View Full Code Here

           
            int[] size = CustomizableTabularExporterUtilities.countColumnsRows(
                    project, engine, params);
           
            URL worksheetFeedUrl = spreadsheetEntry2.getWorksheetFeedUrl();
            WorksheetEntry worksheetEntry = new WorksheetEntry(size[1], size[0]);
            worksheetEntry.setTitle(new PlainTextConstruct("Uploaded Data"));
           
            final WorksheetEntry worksheetEntry2 =
                spreadsheetService.insert(worksheetFeedUrl, worksheetEntry);
           
            spreadsheetEntry2.getDefaultWorksheet().delete();
           
            new Thread() {
View Full Code Here

    FeedURLFactory urlFactory = FeedURLFactory.getDefault();
    WorksheetQuery worksheetQuery =
      new WorksheetQuery(urlFactory.getWorksheetFeedUrl(ssKey, "private", "values"));
    worksheetQuery.setTitleQuery(kind);
    WorksheetFeed spreadsheetFeed = ss.query(worksheetQuery, WorksheetFeed.class);
    WorksheetEntry workSheet = spreadsheetFeed.getEntries().get(0);
    final int colCount = workSheet.getColCount();
    String[] columnTitle = new String[colCount];
    String[] dataType = new String[colCount];

    URL cellFeedUrl = workSheet.getCellFeedUrl();
    CellQuery query = new CellQuery(cellFeedUrl);

    // Title & Type
    query.setMinimumRow(1);
    query.setMaximumRow(2);
    CellFeed feed = ss.query(query, CellFeed.class);
    for (CellEntry cell : feed.getEntries()) {
      final String shortId = cell.getId().substring(cell.getId().lastIndexOf('/') + 1);
      logger.fine(shortId + ":" + cell.getCell().getValue());
      int row = Integer.parseInt(shortId.substring(1, shortId.lastIndexOf('C')));
      int col = Integer.parseInt(shortId.substring(shortId.lastIndexOf('C') + 1));
      if (row == 1) {
        columnTitle[col - 1] = cell.getCell().getValue();
      } else {
        dataType[col - 1] = cell.getCell().getValue();
      }
    }

    // Data (start from line no.3)
    query.setMinimumRow(startIndex);
    final int nextMax = startIndex + maxRows - 1;
    final int maxRowCount = workSheet.getRowCount();
    final int maxRow = (nextMax > maxRowCount) ? maxRowCount : nextMax;
    logger.fine(startIndex + "〜" + maxRow);
    if (startIndex >= maxRow) {
      return null;
    }
View Full Code Here

      SpreadsheetEntry spreadsheetEntry = spreadsheetFeed.getEntries().get(0);

      // Modify a default worksheet
      URL worksheetFeedUrl = spreadsheetEntry.getWorksheetFeedUrl();
      WorksheetFeed worksheetFeed = ss.getFeed(worksheetFeedUrl, WorksheetFeed.class);
      WorksheetEntry defaultWorksheet = worksheetFeed.getEntries().get(0);
      defaultWorksheet.setTitle(new PlainTextConstruct(targetKinds.get(0)));
      defaultWorksheet.setRowCount(2);
      defaultWorksheet.setColCount(1);
      defaultWorksheet.update();
      logger.info("Worksheet:" + targetKinds.get(0) + "is created.");

      // Add other Worksheets
      for (int i = 1; i < targetKinds.size(); i++) {
        WorksheetEntry newWorksheet = new WorksheetEntry();
        newWorksheet.setTitle(new PlainTextConstruct(targetKinds.get(i)));
        newWorksheet.setRowCount(2);
        newWorksheet.setColCount(1);
        ss.insert(worksheetFeedUrl, newWorksheet);
        logger.info("Worksheet:" + targetKinds.get(i) + "is created.");
      }
      logger.info("Created new file:" + fileName);
      return spreadsheetEntry;
View Full Code Here

    }

    // Modify a worksheet's column size
    URL worksheetFeedUrl = spreadsheetEntry.getWorksheetFeedUrl();
    WorksheetFeed worksheetFeed = ss.getFeed(worksheetFeedUrl, WorksheetFeed.class);
    WorksheetEntry worksheetEntry = null;
    for (WorksheetEntry worksheet : worksheetFeed.getEntries()) {
      if (kind.equals(worksheet.getTitle().getPlainText())) {
        worksheetEntry = worksheet;
        break;
      }
    }
    if (worksheetEntry == null) {
      throw new RuntimeException("Cannot find worksheet:" + kind);
    }
    worksheetEntry.setColCount(properties.size() + 1);
    worksheetEntry.update();
    logger.info("Worksheet:" + kind + "'s column-size is set to " + (properties.size() + 1));

    FeedURLFactory factory = FeedURLFactory.getDefault();
    URL tableFeedUrl = factory.getTableFeedUrl(ssKey);
View Full Code Here

   */
  private void fillWorksheetListBox(String spreadsheetTitle) {
    String[] stringsForListbox = new String[worksheetEntries.size()];

    for (int i = 0; i < worksheetEntries.size(); i++) {
      WorksheetEntry entry = worksheetEntries.get(i);

      // Title Of Worksheet (T)
      stringsForListbox[i] = entry.getTitle().getPlainText()
          + " (in " + spreadsheetTitle + ")";
    }

    worksheetListBox.setListData(stringsForListbox);
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.spreadsheet.WorksheetEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.