Google-sheets – How to set the Title of Form in a popup of Google Spreadsheets as a link

google sheetsgoogle-apps-scriptgoogle-formslinks

I have changed the sheet keys below for confidentiality.

How to I set the Title of Form in a Popup of Google Spreadsheets as a LINK. What which was the Popup that created by me?

Attempt 1 :     
THE OUTPUT OF THE TITLE    is came out like this:    " https://docs.google.com/forms/d/e/ABcdeFgHIjkLMNopQrSTuvwxYZ123456790/viewform' target='_blank'/>TEST FORM " !

var form = FormApp.openById('ABcdeFgHIjkLMNopQrSTuvwxYZ123456790'),
    Body = HtmlService.createHtmlOutput("<iframe src='" + form.getPublishedUrl() + "?embedded=true#start=embed' width='450' height='635' scrolling='yes' frameborder='0' allowtransparency='yes' style='overflow-y:hidden; overflow-x:hidden; margin-left:'-60px'; margin-top:'-190px'; margin-bottom:'-20px';'>Memuat...</iframe>")
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .setTitle("<a href='" + form.getPublishedUrl() + "' target='_blank'/>" + form.getTitle() + "</a>")
      .setWidth(470) 
      .setHeight(470);

  ss.show(Body);

Attempt 2 :     
THE OUTPUT OF THE TITLE    is came out like this:    " HtmlOutput " !

var form = FormApp.openById('ABcdeFgHIjkLMNopQrSTuvwxYZ123456790'),
    Body = HtmlService.createHtmlOutput("<iframe src='" + form.getPublishedUrl() + "?embedded=true#start=embed' width='450' height='635' scrolling='yes' frameborder='0' allowtransparency='yes' style='overflow-y:hidden; overflow-x:hidden; margin-left:'-60px'; margin-top:'-190px'; margin-bottom:'-20px';'>Memuat...</iframe>")
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .setTitle(HtmlService.createHtmlOutput("<a href='" + form.getPublishedUrl() + "' target='_blank'/>" + form.getTitle() + "</a>"))
      .setWidth(470) 
      .setHeight(470);

  ss.show(Body);

Attempt 3 :     
THE OUTPUT OF THE TITLE    is came out like this:    " Anchor " !

var form = FormApp.openById('ABcdeFgHIjkLMNopQrSTuvwxYZ123456790'),
    Body = HtmlService.createHtmlOutput("<iframe src='" + form.getPublishedUrl() + "?embedded=true#start=embed' width='450' height='635' scrolling='yes' frameborder='0' allowtransparency='yes' style='overflow-y:hidden; overflow-x:hidden; margin-left:'-60px'; margin-top:'-190px'; margin-bottom:'-20px';'>Memuat...</iframe>")
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .setTitle(UiApp.createApplication().createAnchor(form.getTitle(), form.getPublishedUrl()))
      .setWidth(470) 
      .setHeight(470);

  ss.show(Body);

Attempt 4 :     
THE OUTPUT OF THE TITLE    is came out like this:    " https://docs.google.com/forms/d/e/ABcdeFgHIjkLMNopQrSTuvwxYZ123456790/viewform' target='_blank'/>TEST FORM " !

var form = FormApp.openById('ABcdeFgHIjkLMNopQrSTuvwxYZ123456790'),
    title = "<a href='" + form.getPublishedUrl() + "' target='_blank'/>" + form.getTitle() + "</a>",
    Body = HtmlService.createHtmlOutput("<iframe src='" + form.getPublishedUrl() + "?embedded=true#start=embed' width='450' height='635' scrolling='yes' frameborder='0' allowtransparency='yes' style='overflow-y:hidden; overflow-x:hidden; margin-left:'-60px'; margin-top:'-190px'; margin-bottom:'-20px';'>Memuat...</iframe>")
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .setWidth(470) 
      .setHeight(470);

  SpreadsheetApp.getUi().showModelessDialog(Body, title);

Attempt 5 :     
THE OUTPUT OF THE TITLE    is came out like this:    " HtmlOutput " !

var form = FormApp.openById('ABcdeFgHIjkLMNopQrSTuvwxYZ123456790'),
    title = HtmlService.createHtmlOutput("<a href='" + form.getPublishedUrl() + "' target='_blank'/>" + form.getTitle() + "</a>"),
    Body = HtmlService.createHtmlOutput("<iframe src='" + form.getPublishedUrl() + "?embedded=true#start=embed' width='450' height='635' scrolling='yes' frameborder='0' allowtransparency='yes' style='overflow-y:hidden; overflow-x:hidden; margin-left:'-60px'; margin-top:'-190px'; margin-bottom:'-20px';'>Memuat...</iframe>")
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .setWidth(470) 
      .setHeight(470);

  SpreadsheetApp.getUi().showModelessDialog(Body, title);

Attempt 6 :     
THE OUTPUT OF THE TITLE    is came out like this:    " Anchor " !

var form = FormApp.openById('ABcdeFgHIjkLMNopQrSTuvwxYZ123456790'),
    title = UiApp.createApplication().createAnchor(form.getTitle(), form.getPublishedUrl()),
    Body = HtmlService.createHtmlOutput("<iframe src='" + form.getPublishedUrl() + "?embedded=true#start=embed' width='450' height='635' scrolling='yes' frameborder='0' allowtransparency='yes' style='overflow-y:hidden; overflow-x:hidden; margin-left:'-60px'; margin-top:'-190px'; margin-bottom:'-20px';'>Memuat...</iframe>")
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .setWidth(470) 
      .setHeight(470);

  SpreadsheetApp.getUi().showModelessDialog(Body, title);

The Problem is :

All my attempts have "FAILED"

The Expected Outcome is:

TEST FORM     as the Title Form of the ID which was ABcdeFgHIjkLMNopQrSTuvwxYZ123456790

Best Answer

It's not possible to add a link to the title of a custom dialog, instead, add the link to the body of the custom dialog adding a special formatting to it, like <b>, <h1> among other options.