Forum Discussion
KateRobertson
10 years agoCommunity Member
Exporting Variables into a Google Spreadsheet
Having read this post on how to export variables to be read in a google spreadsheet, I set about trying to get this working in my project, I soon ran into problems, I just could not get it to work a...
SteveFlowers
10 years agoCommunity Member
You could use other sheets. Depending on the scope and access needs, the way I'd handle that is by adding a field to capture the course ID or title and use a filter to change the report display.
Google Apps Scripts are pretty fantastic. You can even automatically send formatted emails based on a variety of variables.
This is extracted from a function that gathers info from a sheet and sends emails to program owners for a departure clearance process. There is a limit to the number of emails that can be sent from each account per day. For a corporate or government account it's something like 1500.
if (emailSent =="" && emailAddress!="") { // Prevents sending duplicates
var subject = "[Exit Clearance] "+SystemName;
var messageBody="PLEASE DO NOT REPLY TO THIS MESSAGE.<br/><br/>"+MemberName+" ("+MemberOffice+") will be departing the agency after "+DepartureDate+".<br/><br/>You have been listed as program contact for <b>"+SystemName+"</b>. Please process the exit for the member listed above as necessary and click the link below to confirm. <br/><br/><a href='https://docs.google.com/a/nara.gov/forms/d/FORMID/formResponse?entry.2015203526="+uid+"&entry.2111276816="+SystemName+"&entry.2115168075="+MemberName+"&entry.439662642="+MemberOffice+"'>Confirm receipt and action.</a><br/><br/>Clicking the link confirms receipt and indicates that the system or program owner will process the required action on or after the date of departure. A reminder will be sent after the scheduled departure date.";MailApp.sendEmail(emailAddress, subject,'',{htmlBody: messageBody});
sheet.getRange(startRow + i, 3).setValue(EMAIL_SENT);
// Make sure the cell is updated right away in case the script is interrupted
SpreadsheetApp.flush();
}