I have the same problem as discused here: How to pass a parameter to html?
In other words, I need to pass argument to Picker so he know what file I'm selecting. Based on this file type different function will be run as a part of callback.
I'm using Picker sample as provided by Google: https://developers.google.com/apps-script/guides/dialogs
Picker is showed with the following code:
function showPicker() {
var html = HtmlService.createHtmlOutputFromFile('Picker.html')
.setWidth(600)
.setHeight(425)
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
SpreadsheetApp.getUi().showModalDialog(html, 'Select a file');
}
Of course right now I would like to pass argument to picker so it knows what file I am trying to open. Based on the example provided in the previous post (indeed it looks like the best approach) I neded up with the following:
function doGet() {
var htmlTemplate = HtmlService.createTemplateFromFile('Picker');
htmlTemplate.dataFromServerTemplate = { first: "hello", last: "world" };
var htmlOutput = htmlTemplate.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setTitle('sample');
return htmlOutput;
}
Unfortunately Picker window does not show up. How to fix it?
Any help will be much appreciated.