Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.