我一直在寻找没有任何运气的答案,所以我希望比我更聪明的人以前见过这个。这是我的问题:
I. 我有一个绑定到电子表格的 Google 表单来捕获订单数据。该电子表格在一个单元格中有一个数组公式,用于根据表单 (SubTotal) 中的选择计算美元金额。
二、我创建了一个 GAS 以根据表单数据向订购方发送确认电子邮件并复制其他相关方。它有一个 OnFormSubmit 的触发事件。
三、一切都很好,除了字段 SubTotal 的值在脚本生成的电子邮件中显示为“未定义”。
这是 GAS 代码:
function orderconfemail(e) {
var timestamp = e.values[0];
var playerLastName = e.values[1];
var playerFirstName = e.values[2];
var jerseyNumber = e.values[3];
var ageGroup = e.values[5];
var parentLastName = e.values[6];
var parentFirstName = e.values[7];
var toAddress = e.values[8];
var ccAddress = e.values[17];
var teamName = e.values[13];
var coachName = e.values[14];
var mgrName = e.values[16];
var homeSize = e.values[20];
var homeQty = e.values[21];
var awayOrdered = e.values[22];
var awaySize = e.values[23];
var awayQty = e.values[24];
var shortSize = e.values[26];
var shortQty = e.values[27];
var jcktOrdered = e.values[28];
var jcktSize = e.values[29];
var jcktQty = e.values[30];
var pntsOrdered = e.values[31];
var pntsSize = e.values[32];
var pntsQty = e.values[33];
var bagOrdered = e.values[34];
var bagQty = e.values[35];
var orderTotal = e.values[36];
var subject = "Futura FC Uniform Order Confirmation for " + playerFirstName + " " + playerLastName;
var htmlBody = "Thank you for your uniform order, " + parentFirstName + "! Your order date / time was: " + timestamp + "." +
"<br/> </br>Your order details are as follows: " +
"<br/> <br/><b>Player Name:</b> " + playerFirstName + " " + playerLastName +
"<br/><b>Jersey Number:</b> " + jerseyNumber +
"<br/><b>Age Goup:</b> " + ageGroup +
"<br/><b>Team:</b> " + teamName +
"<br/><b>Coach:</b> " + coachName +
"<br/><b>Manager:</b> " + mgrName +
"<br/><b>Home Jersey Size:</b> " + homeSize +
"<br/><b>Home Jersey Qty:</b> " + homeQty +
"<br/><b>Away Jersey Ordered?</b> " + awayOrdered +
"<br/><b>Away Jersey Size:</b> " + awaySize +
"<br/><b>Away Jersey Qty:</b> " + awayQty +
"<br/><b>Short Size:</b> " + shortSize +
"<br/><b>Short Qty:</b> " + shortQty +
"<br/><b>Warm Up Jacket Ordered?</b> " + jcktOrdered +
"<br/><b>Jacket Size:</b> " + jcktSize +
"<br/><b>Jacket Qty:</b> " + jcktQty +
"<br/><b>Warm Up Pants Ordered?</b> " + pntsOrdered +
"<br/><b>Pants Size:</b> " + pntsSize +
"<br/><b>Pants Qty:</b> " + pntsQty +
"<br/><b>Backpack Ordered?</b> " + bagOrdered +
"<br/><b>Backpack Qty:</b> " + bagQty +
"<br/> <br/><b>Your Order Total:</b> " + orderTotal;
var optAdvancedArgs = {cc: ccAddress, bcc: "someone@aol.com,someone@embarqmail.com", htmlBody: htmlBody};
MailApp.sendEmail(toAddress, subject, "Message Body", optAdvancedArgs);
}
这就是它在我的电子邮件中的显示方式(为了空间,我删除了除小计之外的所有内容)。
谢谢你的制服订单,家长!您的订单日期/时间是:5/23/2012 20:10:23。
您的订单总额:未定义
电子表格确实显示了正确的计算小计,但电子邮件没有。我可以吗:
I. 计算 GAS 中的小计?
二、强制脚本在发送电子邮件之前将行写入电子表格?
提前致谢!