Skip to content

Instantly share code, notes, and snippets.

@suntong
Created December 20, 2013 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suntong/8049824 to your computer and use it in GitHub Desktop.
Save suntong/8049824 to your computer and use it in GitHub Desktop.
Google Picker for Google Docs
// http://stackoverflow.com/questions/20599404/google-picker-for-google-drive
function doGet() {
var app = UiApp.createApplication();
var selectCkH = app.createServerHandler('selectFile');
var closeHandler = app.createServerHandler('closeDocsPicker');
var docsDialog = app.createDocsListDialog().showDocsPicker()//.setInitialView(google.picker.ViewId.FOLDERS)
// .addView(new google.picker.PhotosView()
// .setType(google.picker.PhotosView.Type.FEATURED))
.addCloseHandler(closeHandler)
.addSelectionHandler(selectCkH);
docsDialog.setDialogTitle('Select a Doc From Drive:');
return app;
}
function closeDocsPicker() {
var app = UiApp.getActiveApplication();
// close operations
return app;
}
function selectFile (e) {
var app = UiApp.getActiveApplication();
var fileId = e.parameter.items[0]['id'];
app.add(app.createLabel('File Id of Selected Doc: '+fileId));
return app;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment