简体   繁体   English

我正在尝试从谷歌电子表格发送 email,但是该消息并未复制超链接

[英]I'm trying to send an email from google spreadsheet, however the message is not copying the hyperlink

I have "to" in column A & "message/body" in column "B".我在 A 列中有“to”,在“B”列中有“message/body”。 I have a code which sends an email.我有一个发送 email 的代码。 However in my message I have a word hyperlinked to another sheet, while sending the email, the hyperlink is not considered.但是,在我的消息中,我有一个超链接到另一张纸的单词,在发送 email 时,不考虑超链接。 Please find the screenshot below.请在下面找到屏幕截图。 超链接在 B 列中可见

However when the email is sent, the hyperlink is not visible.但是,当发送 email 时,超链接不可见。 Please the image below请看下图

电子邮件中不考虑超链接

    function sendEmails() {    
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 2;
  var numRows = 1;
  var dataRange = sheet.getRange(startRow, 1, numRows, 2);
  var data = dataRange.getValues();
  for (var i in data) {
    var row = data[i];
    var emailAddress = row[0]; // First column
    var message = row[1]; // Second column
    var subject = 'Sending emails from a Spreadsheet';
    MailApp.sendEmail(emailAddress, subject, message);
  }
} 

UseTemplated HTML使用模板化 HTML

var htmlBody = HtmlService.createTemplate('Email with <a href=<?=link?>> Some link </a>');  

htmlBody.link = row[1];

MailApp.sendEmail({
  to: row[0],
  subject: 'Sending emails from a Spreadsheet',
  htmlBody: htmlBody.evaluate().getContent()
});  

If you have embedded cell links, you can extract them using Advanced Sheets services, as describe here , for example如果您有嵌入的单元格链接,您可以使用高级表格服务提取它们,如此所述,例如

var values = Sheets.Spreadsheets.get(SpreadsheetApp.getActive().getId(), {ranges: "Sheet1!B1:B10", fields: "sheets/data/rowData/values/hyperlink"})
var links = values.sheets[0].data[0].rowData.map(v => v.values[0].hyperlink);

them use them in templated HTML example I provided.他们在我提供的模板化 HTML 示例中使用它们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在尝试从我的电子表格中获取图表以使用谷歌脚本发送 email,但 getAs() function 不起作用 - I'm trying to get a chart from my spreadsheet to send in an email using google script, but the getAs() function isn't working 从Google电子表格发送自动电子邮件? - Send an automated email from google spreadsheet? 我正在尝试使用 Google Scripts 为电子表格的每一新行发布一条 Slack 消息 - 但我只收到一个帖子。 我究竟做错了什么? - I'm trying to post a Slack message for each new row of a spreadsheet using Google Scripts - but I'm only getting one post. What am I doing wrong? 我正在尝试发送带有 node、nodemon、express 和 dotenv 的 email - I'm trying to send an email with node, nodemon, express and dotenv 在 Google 电子表格中向多个地址发送一封电子邮件 - Send one Email to Multiple Addresses in Google Spreadsheet 将电子邮件发送到Google电子表格中的多个地址 - Send Email to Multiple Addresses in Google Spreadsheet 在 2 人使用我的 discord 机器人对 discord 消息做出反应后,我正在尝试发送消息 - I'm trying to send a message after 2 persons react to a discord message using my discord bot 我正在尝试从javascript加载弹出窗口,但是可以,当我单击以关闭弹出窗口时,没有任何反应 - I'm trying to load a popup from javascript, which works, however, when I click to close the popup it nothing happens Google Apps Script 通过电子表格发送电子邮件不起作用 - Google Apps Script send email through spreadsheet not working 使用 AppScript 将 Google 电子表格转换为 Excel 并通过电子邮件发送 - Converting Google Spreadsheet to Excel with AppScript and send it via email
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM