I'm looking for a script that I can add to a Google sheet that will auto generate an email and include some of the fields in the spread sheet.
I had created a Google Form and I have that data going to the Google spreadsheet, the idea is when the user submits the form it sends that data to the spreadsheet and the spreadsheet sends an automated email.
I found this script and edited it some but it fails on the 4th line (var theEvent = e.values[1]
):
function AutoConfirmation(e){
var theirFirst = "Bill";
var theirEmail = [email protected];
var theEvent = e.values[1];
var subject = "Form Submitted";
var message = "Thank you, " + theirFirst + " for the expressed interest in our " + theEvent;
MailApp.sendEmail (theirEmail, subject, message);
}
Shouldn't line 4 pull the data from column 1 in my google sheet? Is this old an script and it doesn't work now? In my google sheet I have Site instead of event as a column and another that has Complete as a header. Let me know what I have missed here as it seems that this should be simple. I tried to run this and this is the result: screenshot of the error I get I get the same type of error when running the code above so I thought I would run a logger to see if I get anything with that and the result is in the screen shot. Click the link to see it.
but it fails on the 4th line (var theEvent = e.values[1]):
, I cannot understand about the detail of your issue, if you directly run the function by the script editor, an error occurs because the event object is not used. How about this? – Tanaikee.values[1]
corresponds to column B. Is that the data you want to retrieve? – Iamblichus