google-sheetsgoogle-apps-scriptprompt

How can I create a google scripts prompt that accepts multiple inputs


I've created a google scripts app that gives the user a prompt and accepts a single input, which is then used later on within the script (I'm querying an API using and outputting the results into Google sheets and need username / pwd etc).

My code so far:

var ui = SpreadsheetApp.getUi();
var result = ui.prompt('Please enter API password',
                       ui.ButtonSet.OK_CANCEL);
var button = result.getSelectedButton();
var text = result.getResponseText();
if (button == ui.Button.OK) {
    // User clicked "OK".
    var pw = text; 
 }

However, I would like to increase this to four string responses that are all captured as variables that are then used in the rest of the script. Is this possible without having multiple prompts?


Solution

  • You could create a dialog or sidebar by using the HTML Service. For details see Dialogs and Sidebars in G Suite Documents

    Related questions