function
sendFormByEmail
()
{
var
subject
= "TC Edit"
//sets the subject of the email.
var
s
= SpreadsheetApp
. getActive
(). getSheetByName
( "Form Responses 1"
); //get the spreadsheet by name
var
lr
= s
. getLastRow
(); //gets the last row from the spreadsheet name from above
var
lrTime
= s
. getRange
( lr
, 1
). getValue
(); //gets the value from the last range in the colum # specified for the 'Time' column
var
lrName
= s
. getRange
( lr
, 2
). getValue
(); //gets the value from the last range in the colum # specified for the 'Name' column
var
lrCategory
= s
. getRange
( lr
, 3
). getValue
(); //gets the value from the last range in the colum # specified for the 'Category' column
var
lrFixRequest
= s
. getRange
( lr
, 4
). getValue
(); //gets the value from the last range in the colum # specified for the 'FixRequest' column
var
lrFixReason
= s
. getRange
( lr
, 5
). getValue
(); //gets the value from the last range in the colum # specified for the 'Fix Reason' column
var
lrSchedulingReq
= s
. getRange
( lr
, 6
). getValue
(); //gets the value from the last range in the colum # specified for the 'Scheduling Request' column
var
lrSchedulingReason
= s
. getRange
( lr
, 7
). getValue
(); //gets the value from the last range in the colum # specified for the 'Scheduling Reason' column
//this is the body of the message. Note: "+\n\n" adds a spacing between lines.
var
message
= " Timestamp: "
+ lrTime
+ "\n\n"
+ " Name: "
+ lrName
+ "\n\n"
+ " Category: "
+ lrCategory
+ "\n\n"
+ " Fix Request: "
+ lrFixRequest
+ "\n\n"
+ " Fix Reason: "
+ lrFixReason
+ "\n\n"
+ " Scheduling Request: "
+ lrSchedulingReq
+ "\n\n"
+ " Scheduling Reason: "
+ lrSchedulingReason
+ "\n\n"
;
MailApp
. sendEmail
( email
, subject
, message
)
}