javascript - Google Sheets Script only working on one file -
i trying have google forms on our website auto-notify when user completes form , return data entered in concise email. not way google notifies links form view response. searched online , found code:
function sendformbyemailprayer(e) { // remember replace xyz own email address var email = "admin@communionchapelefca.org"; // optional change following variable // have custom subject google docs emails var subject = "prayer form form submitted"; // variable e holds form values in array. // loop through array , append values body. var s = spreadsheetapp.getactivesheet(); var headers = s.getrange(1,1,1,s.getlastcolumn()).getvalues()[0]; var urltodoc = spreadsheetapp.getactive().geturl(); var body = ""; body = body + "link document: " + urltodoc; var message = body + "\n\n" + ""; // credit henrique abreu fixing sort order for(var in headers) message += headers[i] + ' = '+ e.namedvalues[headers[i]].tostring() + "\n\n"; // mailapp service of google apps script // sends email. can use gmailapp here. mailapp.sendemail(email, subject, message); // watch following video details // http://youtu.be/z6klwuxrwqi // amit agarwal - www.labnol.org }
it works great on 1 form, when copied , pasted working code our other 6 forms, not work @ all. how work across our 7 forms? in advance.
well found better solution code presented above. if use new google forms can add "add-on" (yourform-->three dots in top right-->add-ons).
from there "simply send" auto email response headers. took me 5 seconds setup each of forms.
Comments
Post a Comment