0
votes

Final Goal: Send an automatic email to a list of emails of the last row of data.

I have Google form responses coming into a spreadsheet. I can easily add an email sending on the information to my team however I want to pull in some data from another sheet dependent on the form responses.

enter image description here

In the next step I want to send the combined data in an email. I only want to send the last row of data. My question is if someone has an idea of how to trigger an email when the data has been pulled in from another spreadsheet and not just the form responses. I have been scratching my head trying to figure out what kind of trigger I could use as it needs to be delayed enough for the data to be pulled in.

enter image description here

Spreadsheet here...

1
Don't worry about trying to get the lastRow just use the onFormSubmit trigger for a spreadsheet and get the values from e.values or e.namedValues where e is the event object from the trigger, - Cooper
Thanks, I will give it a go. - Mee
Did you get to solve this based on Cooper's advice? If that's the case, would you consider posting an answer? If you're struggling with this, I'd suggest you to provide information on your current situation so that people here can help, including the code you're working on. - Iamblichus
I went down the road of using a completely different route, I only needed a slight delay so I used the code I found here stackoverflow.com/questions/50199186/…, pulled in my data and used onChange trigger with a Utilities.sleep() delay - Mee
Consider posting an answer explaining how you solved this issue. - Iamblichus

1 Answers

0
votes

I believe you have the pull in data and the sending email resolved. All you need to create de delay you need is to use flush() method previous to send the emails, to ensure the pull in work to your spreadsheet is complete:

// pull your info (I believe you got it resolved)
 ...`enter code here`
SpreadsheetApp.flush(); // for the changes to take place
// sendMails (I understand you got it resolved)
...`enter code here`

https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#flush()

I hope this is what you are asking for, other wise you let me know.