Skip to main content link. Accesskey S
  • Help
  • HCL Logo
  • HCL Notes and Domino Application Development wiki
  • THIS WIKI IS READ-ONLY. Individual names altered for privacy purposes.
  • HCL Forums and Blogs
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • API Documentation
Search
Community Articles > Designing Applications > Google Spreadsheet Listing - Xpages
  • Share Show Menu▼
  • Subscribe Show Menu▼

Recent articles by this author

Run Lotus Notes Text Data via URL in JDeveloper

Knowledge Sharing Döcu Content Read Lotus Notes Data via URL in JDeveloper XpagesJSF Application Introduction: Read App Data from Lotus Notes Database into Java Server Faces Page on JDeveloper, running on Weblogic Server Current Lotus Notes JavaAgent, code running the actual TXT file ...

New Doc: Read Lotus Notes Text Data via URL in JDeveloper

Knowledge Sharing JDeveloper Read Lotus Notes Data via URL Part 3 Introduction: Read App Data from Lotus Notes Database into Java Server Faces Page on JDeveloper, running on Weblogic Server Going forward , we will be looking at the data through TXT data in URL from Lotus Notes Database, ...

Read Lotus Notes Text Data via URL in JDeveloper

Knowledge Sharing JDeveloper Read Lotus Notes Data via URL Part 3 Introduction: Read App Data from Lotus Notes Database into Java Server Faces Page on JDeveloper, running on Weblogic Server Going forward , we will be looking at the data through TXT data in URL from Lotus Notes ...

Read Lotus Notes Data via URL in JDeveloper

Knowledge Sharing JDeveloper Read Lotus Notes Data via URL Part 3 Introduction: Read App Data from Lotus Notes Database into Java Server Faces Page on JDeveloper, running on Weblogic Server Going forward , we will be looking at the data through TXT data in URL from Lotus Notes ...

Google WorkSheets Xpages App (Google Drive)

Knowledge Sharing Döcu Content Google Worksheets inputText JavaAgentJavaBean Xpages Application System Requirements: Download Domino Designer 8.5.3 Environment (DDE) http:www.ibm.comdeveloperworksdownloadslsdominodesigner Download Make available Google Spreadsheets API ...
Community articleGoogle Spreadsheet Listing - Xpages
Added by ~Zelda Frokrotexettu | Edited by ~Zelda Frokrotexettu on March 10, 2015 | Version 7
  • Actions Show Menu▼
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: Google Drive, Java, Xpages

Knowledge Sharing

Döcu Content

Google Worksheets

JavaAgent/JavaBean

Xpages Application

 

System Requirements:

Download Domino Designer 8.5.3 Environment (DDE)

http://www.ibm.com/developerworks/downloads/ls/dominodesigner/

 

Download /Make available Google Spreadsheets API

https://developers.google.com/google-apps/spreadsheets/

https://developers.google.com/google-apps/documents-list/

 

 

Introduction:

In this tutorial, we are connecting to Google to read a Spreadsheet and listing its Worksheets using a button. Slight modifcation is made to existing code to convert to JavaAgent, JavaBean written to run code through Browser. See below for code samples to use to run the program, Xpages XSP file included..

 

Disclaimer:

Information contained in the following is presented as is. This tutorial assumes you have basic Lotus Notes Configuration, Programming knowledge, and are familiar with Google APIs.

 

Döcu Content JavaAgent/JavaBean/Xpages

At this point, we assume you have gone through the prior tutorial, and maintained JAR configuration to be able to use the Google Spreadsheet API. Copy and paste code below into DDE and submit a new Worksheet, areas of interests are highlighted for your convenience.

 

Related Info:

https://www.youtube.com/watch?v=GCPsQwv7xVo&list=UUSImDTpK0oe7QrPsYOE4nww

 

Copy and Paste Page Design code

 

More than likely, you have also configured faces config XML file in this application. Load the Xpage to your Browser and click that button.

 

ReadGoogleDriveWorkSheetJavaAgent.java;

 

/**

* Created from copy: 2014.05.15.9.14.PM

* GoogleSpreadsheetsGoodJavaAgentCopy | ReadGoogleDriveWorkSheetJavaAgent.java

* List Worksheets in specific Spreadsheet, housed on Google Drive

*/

 

...

Google imports

import com.google.gdata.client.spreadsheet.SpreadsheetService;

import com.google.gdata.data.PlainTextConstruct;

import com.google.gdata.data.spreadsheet.SpreadsheetEntry;

import com.google.gdata.data.spreadsheet.SpreadsheetFeed;

import com.google.gdata.data.spreadsheet.WorksheetEntry;

import com.google.gdata.util.AuthenticationException;

import com.google.gdata.util.ServiceException;

 

...

Java imports

import java.io.IOException;

import java.net.URL;

import java.util.List;

 

...

Lotus Domino imports

import lotus.domino.AgentBase;

 

/**

* @author Dököll Solutions, Inc.

* @version 2014.05.15.9.14.PM

*

*/

 

public class ReadGoogleDriveWorkSheetJavaAgent extends AgentBase {

 

public ReadGoogleDriveWorkSheetJavaAgent() {

...

}

 

button code...

public void NotesMain() {

 

try {

 

TODO: see about connecting automatically...

existing Google Drive login creds...

String USERNAME = "yourgoogleaccount@gmail.com";

String PASSWORD = "youraccountpassword";

 

SpreadsheetService service = new SpreadsheetService(

"MySpreadsheetIntegration");

service.setUserCredentials(USERNAME, PASSWORD);

 

 TODO: Authorize the service object for a specific user (see other

sections)

 

Define the URL to request. This should never change.

URL SPREADSHEET_FEED_URL = new URL(

"https:spreadsheets.google.com/feeds/spreadsheets/private/full");

 

Make a request to the API and get all spreadsheets.

SpreadsheetFeed feed = service.getFeed(SPREADSHEET_FEED_URL,

SpreadsheetFeed.class);

List spreadsheets = feed.getEntries();

 

if (spreadsheets.size() == 0) {

 TODO: There were no spreadsheets, act accordingly.

}

 

 TODO: Choose a spreadsheet more intelligently based on your

app's needs.

SpreadsheetEntry spreadsheet = spreadsheets.get(0);

System.out.println(spreadsheet.getTitle().getPlainText());

 

Create a local representation of the new worksheet.

WorksheetEntry worksheet = new WorksheetEntry();

worksheet

.setTitle(new PlainTextConstruct("Groovy Dököll Worksheet"));

worksheet.setColCount(10);

worksheet.setRowCount(20);

 

Send the local representation of the worksheet to the API for

creation. The URL to use here is the worksheet feed URL of our

spreadsheet.

URL worksheetFeedUrl = spreadsheet.getWorksheetFeedUrl();

service.insert(worksheetFeedUrl, worksheet);

 

} catch (AuthenticationException e) {

 TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

 TODO Auto-generated catch block

e.printStackTrace();

} catch (ServiceException e) {

 TODO Auto-generated catch block

e.printStackTrace();

} finally {

 

}

}

}

 

 

RunGoogleSpreadsheetsBean.java;

 

/**

* Created from Copy: 2014.05.15.9.16.AM

* RunGoogleSpreadsheetsBean.java

* Run JavaAgent, Connect to Google | Create New Worksheet

*/

package com.dokoll.solutions.inc.google.dev;

 

...

Faces imports

 

import javax.faces.context.FacesContext;

 

...

Domino imports

import lotus.domino.NotesException;

import lotus.domino.local.Database;

 

...

Apache imports

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

 

/**

* @author Dököll Solutions, Inc.

* @version 2014.05.15.9.16.AM

*

*/

 

...

public class RunGoogleSpreadsheetsBean {

 

 

button code

public void doRunSpreadsheetData() throws NotesException{

set up the loggers

Log log = LogFactory.getLog(RunGoogleSpreadsheetsBean.class);

Log debug = LogFactory.getLog("DEBUG");

 

tell what they are

System.out.println("log is a " + log.getClass().getName());

System.out.println("debug is a " + debug.getClass().getName());

 

 

log.info("an info message");

debug.debug("a debug message");

 

log.info("another info message");

debug.debug("another debug message");

...

get the current database being used

Database database= (Database) FacesContext.getCurrentInstance()

.getApplication().getVariableResolver()

.resolveVariable(FacesContext.getCurrentInstance(), "database");

System.out.println("Database Obtained..." + database);

System.out.println("Connecting to Google...");

...

Run the agent...

database.getAgent("GoogleSpreadsheetsGoodJavaAgentCopy").runOnServer();

}

 

}

 

 

Döcu Content Console View (Console/Drive)

 

Full page design: Here is the button in question...

 

[UPDATE 2015.07.10.19.AM]: there was an issue submitting XML code specific to below Xpages Design showing the button, please reference Related Information at the end of this tutorial for the full document, please excuse the inconvenience.

 


 

 

bottom part of the document

 


 

 

 

TIP: You may want to Extract part of the Spreadsheet listing code to loop through and list worksheet(s) by name via yet another Xpages form, or to existing submit page...

 

Conclusion:

You can now run code from a button to add Worksheets to existing Spreadsheet, publically available on Google Drive.

 

Questions, comments, please post a brief message on our Contact form on the main site.

 

Related Info:

http://www.dokollsolutionsinc.com/CutAndPasteGoogleSheetXpages.html

http://www.openntf.org/main.nsf/project.xsp?r=project/D%C3%B6cu%20Content%20V3.0

 

Thank you for coming...

 

Version:2014.05.17.1.41.AM


  • Actions Show Menu▼


expanded Attachments (1)
collapsed Attachments (1)
Edit the article to add or modify attachments.
File TypeSizeFile NameCreated OnDelete file
application/pdf 63 KB xprungooglespreadsheets.pdf 3/7/15, 3:19 PM
expanded Versions (7)
collapsed Versions (7)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (7)Mar 10, 2015, 4:37:19 AM~Zelda Frokrotexettu  Added OpenNTF link
6Mar 7, 2015, 3:26:30 PM~Tanita Brehipimar  
5Mar 7, 2015, 3:20:05 PM~Tanita Brehipimar  Attaching a file with the xpage code...
4Mar 7, 2015, 3:13:17 PM~Tanita Brehipimar  
3Mar 7, 2015, 3:12:32 PM~Tanita Brehipimar  
2Mar 7, 2015, 3:12:02 PM~Tanita Brehipimar  Xpages Code seemingly being previewed in Browser (removed it: 2015.03....
1Mar 7, 2015, 3:08:04 PM~Tanita Brehipimar  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedAbout
  • HCL Software
  • HCL Digital Solutions community
  • HCL Software support
  • BlogsDigital Solutions blog
  • Community LinkHCL Software forums and blogs
  • About HCL
  • Privacy
  • Accessibility