Class DocsListDialog


Deprecated. The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.

A "file-open" dialog for Google Drive. Unlike most UiApp objects, DocsListDialog should not be added to the UiInstance. The example below shows how to display a DocsListDialog in the new version of Google Sheets.

Note that HTML service offers a similar but superior feature, Google Picker. In almost all cases, using Google Picker is preferable.

 function onOpen() {
   SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
       .createMenu('Custom Menu')
       .addItem('Select file', 'showDialog')

 function showDialog() {
   // Dummy call to DriveApp to ensure the OAuth dialog requests Google Drive scope, so that the
   // getOAuthToken() call below returns a token with the necessary permissions.

   var app = UiApp.createApplication()

   var serverHandler = app.createServerHandler('pickerHandler');


   SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showModalDialog(app,' ');

 function pickerHandler(e) {
   var action = e.parameter.eventType;
   var app = UiApp.getActiveApplication();

   if (action == 'selection') {
     var doc = e.parameter.items[0];
     var id =;
     var name =;
     var url = doc.url;
     app.add(app.createLabel('You picked '));
     app.add(app.createAnchor(name, url));
     app.add(app.createLabel('(ID: ' + id + ').'));
   } else if (action == 'close') {
     app.add(app.createLabel('You clicked "Cancel".'));

   return app;

Deprecated methods

Send feedback about...

Apps Script
Apps Script