Home > Back-end >  Is It possible to put images in alerts in google app script?
Is It possible to put images in alerts in google app script?

Time:04-10

I heard that you are unable to put images an alert box in JavaScript, is this the same for App Script, if not how would you insert an image?

CodePudding user response:

You can style your 'alert window' with html/css as much as you like. For example:

function main() {
  var html = `
  <center><img src="https://www.gstatic.com/script/apps_script_1x_48dp.png" /></center>
  <p  style="font-family: sans-serif; color:gray; text-align:center">
  Please wait whilst we process your request,
  this may take several minutes.
  Please do not refresh your page during this time.
  Thank you...</p>
  `
  var htmlOutput = HtmlService
      .createHtmlOutput(html)
      .setWidth(350)
      .setHeight(300);

  SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'Running Request');
}

enter image description here

  • Related