我有一个从面板捕获信息的脚本。输入信息后,用户单击“提交”按钮,输入的数据将存储在电子表格中,该电子表格稍后将用于替换我在该电子表格的单元格上拥有的模板的某些字段。这个过程非常耗时,大约需要一分钟才能完成所有这些。我想知道的是,如果我可以使用参数信息,而不是将数据存储在电子表格的单元格中,并在我拥有的模板上替换它,是否有可能。关于如何做到这一点的任何想法?
function a(e) {
var doc = SpreadsheetApp.getActiveSpreadsheet();
var timecell = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Templates").getRange("A2");
var timebval = timecell.setValue(e.parameter.Times);
var t1 = timecell.getValue();
var mincell = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Templates").getRange("A3");
var minbval = mincell.setValue(e.parameter.Minutes);
var t2 = mincell.getValue();
var namecell = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Templates").getRange("A4");
var nabval = namecell.setValue(e.parameter.Name);
var t3 = namecell.getValue();
var email = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Templates").getRange("A5");
var emaval = email.setValue(e.parameter.email);
var t4 = email.getValue();
var address = "albdominguez25@gmail.com";
var advancedArgs = {bcc:t4};
var emailSubject = "Test";
var emailTemplate =SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Templates").getRange("A1").getValue() ;
emailTemplate = emailTemplate.replace("TIME",t1).replace("MIN",t2).replace("EXP",t3);
MailApp.sendEmail(address, emailSubject, emailTemplate, advancedArgs);
Browser.msgBox("Your Email has been sent!");