I'm attempting to send emails using an HTML template.

I've looked at this post:
(<https://stackoverflow.com/questions/33178702/passing-variables-into-html-code>) 

Would either of the two code examples be close to something that could work to pass the variables from the Javascript to the HTML template?
My javascript variables are named detail2, detail3, detail4, detail5 and detail6.

1st attempt:

```html
<html>
  <head>
    <script>
    {

    var detail2 = document.getElementById("detail2").innerHTML;
    var detail3 = document.getElementById("detail3").innerHTML;
    var detail4 = document.getElementById("detail4").innerHTML;
    var detail5 = document.getElementById("detail5").innerHTML;
    var detail6 = document.getElementById("detail6").innerHTML;

      }
    }
    </script>
  </head>
  <body>

<p>
      <br>"Punctual? " document.getElementById('detail2').value<br>
      <br>"Attention to detail? " document.getElementById('detail3').value<br> 
      <br>"Overall Professionalism? " document.getElementById('detail4').value<br> 
      <br>"Date of Service: " document.getElementById('detail5').value<br>
      <br>"Notes/Details: " document.getElementById('detail6').value<br>
</p>

  </body>
</html>
```

2nd attempt:

```html
<html>
  <head>
    <script>
    {

    <input type="hidden" id="Detail2" value="detail2" />
    <input type="hidden" id="Detail3" value="detail3" />
    <input type="hidden" id="Detail4" value="detail4" />
    <input type="hidden" id="Detail5" value="detail5" />
    <input type="hidden" id="Detail6" value="detail6" />

      }
    }
    </script>
  </head>
  <body>

<p>
      <br>"Punctual? " document.getElementById('detail2').value<br>
      <br>"Attention to detail? " document.getElementById('detail3').value<br> 
      <br>"Overall Professionalism? " document.getElementById('detail4').value<br> 
      <br>"Date of Service: " document.getElementById('detail5').value<br>
      <br>"Notes/Details: " document.getElementById('detail6').value<br>
</p>

  </body>
</html>
```

Finally, the method given on GAS Dev is below, but this only confuses me more. I am sure I've been at this too long and I'm burned out, I just can't seem to see the answer on this one.

```html
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <table>
      <? for (var i = 0; i < data.length; i++) { ?>
        <tr>
          <? for (var j = 0; j < data[i].length; j++) { ?>
            <td><?= data[i][j] ?></td>
          <? } ?>
        </tr>
      <? } ?>
    </table>
  </body>
</html>
```

If anyone can help it's much appreciated!

Below is the Javascript from the .gs script file.

```js
function SendEmail() {
                                   // initialize data
 var ss = SpreadsheetApp.getActiveSpreadsheet();
 var sheet = ss.getActiveSheet();
 var range = sheet.getDataRange();
 var values = range.getValues();
                                   // iteration loop
    for (var i = 1; i<values.length; i++) {
                                   // current times for comparator
 var month = new Date().getMonth();          // returns today as 0-11 -- Jan is 0
 var day = new Date().getDate();             // returns today as 1-31
 var hour = new Date().getHours();           // returns today as 0-23
 var minute = new Date().getMinutes();       // returns today as 0-59
                                   // pull data from spreadsheet rows
 var company = values[i][0];
 var rating = values[i][1];
 var detail1 = values[i][2];
 var detail2 = values[i][3];
 var detail3 = values[i][4];
 var detail4 = values[i][5];
 var detail5 = values[i][6];
 var sendTime = values[i][7];
                                   // character send times for comparator
 var cSendMonth = sendTime.getMonth();        // returns sendMonth as 0-11 -- Jan is 0
 var cSendDay = sendTime.getDate();           // returns sendDay as 1-31
 var cSendHour = sendTime.getHours();         // returns sendHour as 0-23
 var cSendMinute = sendTime.getMinutes();     // returns sendMinute as 0-59
                                   // comparator
    if(cSendMonth == month) {
      if(cSendDay == day) {
        if(cSendHour == hour) {
          if(cSendMinute == minute) {
 var htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();
      MailApp.sendEmail({
          to: Session.getActiveUser().getEmail(),
          subject: 'Test Email markup2 - ' + new Date(),
          htmlBody: htmlBody,
  });
          } // end if minute test
        }// end if hour test
       }// end if day test
      }// end if month test
    }// end for loop
}
```