I am starting with Google Scripts and I was hoping to create a sheet that could email selected cells from a row. What I want to do by selecting Send Email at the end of a row it then selects pre defined cells on the said row and then emails it. I created something in VBA for Excel that does the same trick as shown below.
I am essentially trying to replicate what I have done below using Google Sheets if possible to do via Scripts. Any advice would be much appreciated.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Long
If Target.Count = 1 Then
If Target.Value = "Send Email" Then
r = Target.Row
With CreateObject("Outlook.Application").CreateItem(0)
.Subject = Cells(r, 5).Text
.Body = "============" & vbNewLine & Cells(r, 7).Text & vbNewLine & "============" & vbNewLine & Cells(r, 6).Text
.To = Cells(r, 4).Text
.SentOnBehalfOfName = "7828691"
.Display
End With
End If
End Sub
I have also attached my Google sheet so far to show an example.