google apps script - Passing custom Spreadsheets column to onFormSubmit trigger -
i have google form 2 numbers field, in reply destination spreadsheets have 3 columns: submit-date, num1, num2
i add together 4th column tot, not field in form, formula:
arrayformula(b2:b+c2:c)
so in 4th column have sum every row
i bound script spreadsheet:
function onformsubmit(e){ var subject = "try gas"; var body = e.namedvalues['num1']+ "+" +e.namedvalues['num2']+ "=" +e.namedvalues[tot]; mailapp.sendemail("admin@example.com", subject, body); }
and set trigger onformsubmit
but email received is:
34+43=
while in spreadsheet under column total, 77 displayed.
i think problem var e.namedvalues doesn't contain tot because isn't form field
how can pass value on form submit??
when utilize e.namedvalues['num1']
, getting "namedvalues" property of e
object response coming form.
i' m quite surprised result since nor property in object called "tot"...
normally should homecoming "undefined" obviously.
nevertheless, not actual question, want numeric sum of both values, can them :
var sum = number(e.namedvalues['num1'])+number(e.namedvalues['num2']);// number mandatory because object properties strings in context.
and email body become
var body = e.namedvalues['num1']+ "+" +e.namedvalues['num2']+ "=" +sum;
google-apps-script google-spreadsheet google-apps google-form
No comments:
Post a Comment