I am planning to create HTML table to be embedded in email body. The values in the table come from Googlesheets cells. So I start to create script in my googlesheet. But I have no idea to add the cell value into HTML.
I start using this code:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<?= SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Daily").getRange(13,8).getValue(); ?>
</body>
</html>
and it worked. But I thought it's not good idea. So I tried to put in tag of like this:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<script>
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Daily");
var tgl = sheet.getRange(13,8).getValue();
</script>
<p id="tgl"></p>
<script>
document.getElementById('tgl').innerHTML = tgl;
document.querySelector('#tgl2').innerHTML = tgl.length;
</script>
</body>
</html>
But it didn't work. Would you please to give me advice or suggestion? Thank you in advance