Automated Birthday Email Script using Google Spreadsheets

We usually forget birthdays of our near and dear ones. Facebook help us a lot with the notifications but who is there to take care when you do not check your facebook account.

A good solutions is to set up an automated mailer for the wishes.


1. You need to keep data in Google spreadsheets in this format. In Cell D6, type this formula


and drag it till end.

2. Go to Tools > Script Editor and paste this code there. Save the script.

function sendwishes() {
   var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = spreadsheet.getActiveSheet();
  var lastRow = sheet.getLastRow();
  var startRow = 6;
  var msg = "";
  for (var i =startRow ; i <= lastRow; i++) {
    if(sheet.getRange(i, 4).getValue()==true) {
       MailApp.sendEmail(sheet.getRange(i, 3).getValue(),
        "BirthDay Wishes", "Hi " + sheet.getRange(i, 1).getValue() + "\n\n" + sheet.getRange(2, 2).getValue() + "\n\n" + "Regards,\n" + "YOUR NAME\nYOUR COMPANY");  

3. In Script editor, open Resources >  All your Triggers

4. Create a new trigger. 
     Run > <function name>
     Events > Time Driven + Day Timer

And That's all..!


  1. Hi, Thank you for your excellent script.
    May I know, how i could add HTML Template to make this email a bit nice

  2. Thanks for your script. How can i attach an html page with this mail...

  3. What conditional formatting did you use for your Google sheets?