CreateDocsListDialog setInitialView error

Back again using the createdocsListDialog function :)

I have a job, however I would like to limit the files that will be selected to be only spreadsheets.

"Error: Cannot find the setInitialView method (line). (Line 13)"

. The .setInitialView editor appears in the script editor as a method, but at startup ... not so much. Here is the code.

var doclisthandler = app.createServerHandler('selectionhandler'); var doclist = app.createDocsListDialog().showDocsPicker() .addSelectionHandler(doclisthandler).setInitialView('spreadsheet');

Any ideas?

+3
source share
1 answer

From the very end of the code, you can see that the function setInitialViewdoes not expect a string as a parameter, but a FileType constant. On docs you can see what it is called SPREADSHEETS.

Here's how it works:

app.createDocsListDialog().showDocsPicker().
  addSelectionHandler(doclisthandler).setInitialView(UiApp.FileType.SPREADSHEETS)
+6
source

All Articles