Hello All
I'm fairly new to scripts, and have tried my hand at writing a script that would allow me to send an email to each user with only their data. Here is a link to a sample spreadsheet
For a test, I entered multiple users, but only 1 email address. The email that was sent contained the data columns for all the users on the list. The intended output would be a email to each user with only their data. Also, the % values send as a decimal (0.98 instead of 98%). How
Here is the script I have currently. Any pointers would be appreciated!
function CustomEmail() {
var body,i,name,row;
var emailRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange(2,2,200,1);
var emailAddress = emailRange.getValues();
body = "";
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheet = SpreadsheetApp.getActiveSheet()
var range = sheet.getRange(1,0,sheet.getMaxRows()-1,sheet.getMaxColumns());
var data = range.getValues();
for (i in data) {
row = data[i];
name = row[0];
data1 = row[2];
data2 = row[3];
data3 = row[4];
{
body = body + (name + "\n" + "Data1" + data1 + "\n" + "Data2" + data2 + "\n" + "Data3" + data3);
}
}
var subject = "Your Weekly Numbers";
MailApp.sendEmail(emailAddress, subject, body);
}