Google App 脚本语法错误:运行脚本时出现意外标记“<”

问题描述

有人知道这里有什么问题吗? 它已经工作了多次,即使是

const htmlForEmail = htmlTemplate.evaluate().getContent(); 现在它似乎抛出了一个错误:

错误:错误

语法错误:意外标记“

我的谷歌应用脚​​本代码(html代码在它下面):

 function electrical() {

    const ss = SpreadsheetApp.getActiveSpreadsheet ();
    
    const ws = ss.getSheetByName("Bid Request");

    const h1 = ws.getRange("G4").getValue();
    const headers = ws.getRange("G5:H5").getValues();
    const project = headers [0][0];
    const response = headers [0][1];

    const lr =ws.getLastRow();
    const tableRangeValues = ws.getRange(6,2,lr-6,2).getDisplayValues();

    const htmlTemplate = HtmlService.createTemplateFromFile("email");
    htmlTemplate.h1 = h1;
    htmlTemplate.headers = headers;
    htmlTemplate.project = project;
    htmlTemplate.response = response;
    htmlTemplate.tableRangeValues = tableRangeValues;

    const htmlForEmail = htmlTemplate.evaluate().getContent();

    console.log(htmlForEmail);

    GmailApp.sendEmail(
    "example@gmail.com","Bid Request","Please",{htmlBody: htmlForEmail}
 
   );

  
   }

html:

<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<div>
 <div>
 </div>
 <div>
    
  <h1><?= h1 ?></h1>
  <div></div>
  <table>

  <thead>
  <tr>
  <th><?= project ?></th><th><?= response></th>
  </tr>
  </thead>

  <tbody>

  <? tableRangeValues.forEach(r => { ?>
  <tr>
  <td><?= r[0] ?></td><td><?= r[1] ?></td>
  </tr>
  <?}) ?>

  </tbody>

      
  </div>
  </div>

  </body>
  </html> 

出于某种原因,html 不允许我显示我有标题/正文标签和 html 定义的文档标签,但我有!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...