0

我有一个谷歌电子表格,一旦从表单中填充,我希望用户通过电子邮件发送回表单的内容。

目前它向表单的编辑发送电子邮件,但我想首先包括实际完成表单的人,即 ActiveUser。

这就是我目前拥有的适用于当前要求的功能,但对如何实现此附加功能有任何想法吗?

function sendFormByEmail() {
// set Form Submit trigger from Resources above
var ss = SpreadsheetApp.getActiveSpreadsheet();
var ssName = ss.getName();
var editors = ss.getEditors().join(",");
var owner = ss.getOwner().getEmail();
var subject = "SBS Helpline Enquiry " + ss.getSheetValues(ss.getLastRow(),2,1,1) + "            Requires Action";
<BR/>
// 'to' below will be the recipients of the emailed form responses
// can be to = any one of ( editors , owner , custom , test) no quotes
// both sides of the = should be the same color (not including 'var')
var to = ss.getEditors()// AFTER TESTING: change to either editors , owner , custom
// no quotes in above
var responses=ss.getActiveSheet();
var width=responses.getLastColumn();
var headers=responses.getRange(1,1,1,width ).getValues()[0];
var data=responses.getRange(responses.getLastRow(),1,1,width ).getValues()[0];
var message="PLEASE FORWARD THIS ENQUIRY TO THE RELEVANT CONTACTS" + "\n\n";
for(var i=0;i<width;i++){message+=headers[i] + ' = '+ data[i] + "\n\n";};
MailApp.sendEmail(to,subject,message); 
};

已解决,已使用

to=ss.getSheetValues(ss.getActiveSheet().getLastRow(), 8, 1, 1);
4

1 回答 1

0

有 formEmailer https://sites.google.com/site/formemailer/ 它会做你想做的事,而无需编写代码。

于 2013-12-26T00:33:42.417 回答