I have two files. The first one is a Google Script File (ReportEmail.gs) with the following code:
function doGet() {
var t= HtmlService.createTemplateFromFile('EmailTemplate');
var ss=SpreadsheetApp.getActiveSpreadsheet();
var hoja=ss.getSheetByName("Email");
t.BD=hoja.getRange(1,1,hoja.getLastRow(),hoja.getLastColumn()).getValues();
t.totalCols=hoja.getLastColumn();
t.totalRows=hoja.getLastColumn();
return t.evaluate().getContent();
}
The second one is the HTML template (EmailTemplate.html):
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<?for(var i=0; i<2; i=i+2){
if(BD[4][i+1]=="YES" && BD[0][i]>0){?>
<p><span style="text-decoration: underline;"><strong><?= BD[2][i] ?></strong></span></p>
<ul>
<?for(var j=5; j<BD[0][i]+5; j+1){?>
<li><?= BD[j][i] ?></li>
<?}?>
</ul>
<?}?>
<?}?>
</body>
</html>
When I run the doGet function the script gets stuck and seems to be in a loop forever in the line "return t.evaluate().getContent();". I don't have a spreadsheet with lots of data either. Please help me find the problem! Very appreciated.