Google Sheets 网络应用 运行 脚本作为所有者

Google Sheets web app to run script as owner

你好,有一个简单的脚本,可以从传播中发送电子邮件sheet我需要允许 sheet 的其他用户调用脚本,但我希望脚本是 运行 作为我(所有者)以便从我的帐户发送电子邮件。我查看了一些类似的问题和答案,但似乎没有任何效果。

我的 sheet 上有一个按钮可以使用以下代码调用 doGet 函数。

function doGet(e){

  UrlFetchApp.fetch('https://script.google.com/a/----.org/macros/s/AKfycbxT------------------------------FK5GbrkI/exec').getResponseCode();

}

如果我从浏览器选项卡转到 URL,脚本运行正常,但我无法通过单击我的跨页上的按钮使其工作sheet

您可以创建一个 standalone webapp to handle the emailing. When the user calls the script, a web request is issued from the GAS bound script of the spreadsheet to the published webapp,并且在网络应用程序中您可以从您自己的帐户(即 "Execute the app as: Me")发送电子邮件。您也可以传递参数,例如电子邮件收件人和文本可以作为参数发送。为了清楚起见,这里有一张图片: