This is a simple question about 'Google Apps Script'.
What I have done?
Here I created a sheet with an associated script: https://docs.google.com/spreadsheets/d/1dIsQCs7TX83Y-TFMsnuOKUtkwQFRSCZ21h3E0VH7PBI/edit?usp=sharing
This sheet has email address at cell A1. When the script bound to this sheet is run (Tools > Script editor > Run), it successfully sends the contents of sheet to the email address stored at A1 cell. Currently, this script only takes the contents from B1 cell. I want to extend this functionality to a Form inside of sheet.
This is the associated script:
function sendEmail()
{
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 1; // First row of data to process
var numRows = 1; // Number of rows to process
// Fetch the range of cells
var dataRange = sheet.getRange(startRow, 1, numRows, 2)
// Fetch values for each row in the Range.
var data = dataRange.getValues();
for (i in data)
{
var row = data[i];
var emailAddress = row[0]; // First column
var message = row[1]; // Second column
var subject = "Sending Email from a Spreadsheet Form";
MailApp.sendEmail(emailAddress, subject, message);
}
}
What I am looking for?
How to add a form in above sheet that would allow the user to enter some data from a drop-down list (say product name); and how to add a send button on the form, when this button is clicked, it will send an email with the form’s content (whatever user has selected from the drop-down list) to the email address already entered in sheet on cell at A1.
Thanks a lot
This is almost answer: How to send email from a spreadsheet
Along with:
https://developers.google.com/apps-script/guides/menus?hl=en#drawings