title: In Google scripts, how do you pass a doc url variable into an href statement?
body: <p>I have a bound Google script in a Google Sheets that creates a menu and populates the menu onOpen of the sheet with a bunch of functions. One function creates a new Google Doc. I then want to open that doc, but I can't figure out how to pass the doc's URL into an href statement. See code below:</p>
  
  <pre><code>function createLandscapeLyricDoc() {
    var doc = DocumentApp.create('Rename');
    var title = "replace with song title and then link this text to song title cell in Catalog Spreadsheet"
    var url = doc.getUrl();
    var body = doc.getBody();
    var paragraph = body.insertParagraph(0, "");
    var text1 = paragraph.appendText("© replace with writer(s)");
    text1.setFontSize(8);
    var rowsData = [['PUT FIRST VERSE/CHORUS HERE.  (SUGGEST USE ALL CAPS.)', 'PUT SECOND VERSE/NEXT CHORUS/BRIDGE/ETC HERE.']];
    var style = {};
    body.insertParagraph(0, title)
    .setHeading(DocumentApp.ParagraphHeading.HEADING3);
    table = body.appendTable(rowsData);
    style[DocumentApp.Attribute.BORDER_WIDTH] = 0;
    table.setAttributes(style);
    /*line below is the one that does not work as the variable "url" is not being read correctly (as I don't know how to use it or if this can even be done)*/
    var html = "&lt;a href= 'url'; target='_blank'&gt;Open 1-Column Lyric Template&lt;/a&gt;";
    var selection = SpreadsheetApp.getActiveSheet();
    var userInterface = HtmlService.createHtmlOutput(html);
    SpreadsheetApp.getUi().showModalDialog(userInterface, 'Open Landscape New Lyric Doc'); 
  </code></pre>
  
  <p>It has been suggested that this question has already been answered <a href="https://stackoverflow.com/questions/35971471/how-to-use-a-variable-inside-a-string">here</a> and while I can see why that suggestion was made, I have the following observations:</p>
  
  <p>1) I am way too much of a newbie to Google script coding to know enough terminology to form a search query at Stack Overflow to find that answer. And in fact, had I somehow stumbled across that "answer," I am not sure I would have recognized it as such as the overall code is so different from the code I was struggling with.</p>
  
  <p>2) That solution did not appear as one of the suggested ones for me to review before I asked my question.</p>
  
  <p>Considering these two points together, especially for newbie coders, I think having my question on this site will be helpful to others that fit my profile (and not that of an experienced coder) because this question and answer probably will show up for others trying to do what I was/am trying to do whereas <a href="https://stackoverflow.com/questions/35971471/how-to-use-a-variable-inside-a-string">How to use a variable inside a string</a> Q&amp;A will not.</p>