Sending email from Google Sheets (Google Drive)

Google Drive provides many facilities applications that can be used freely, as well as general file storage. One that has been often we use is Google Sheets. You can take advantage of this spreadsheet as a list to send emails automatically. If you already have a Gmail account, then you can directly access Google Drive here.

Sending Email Automatically

How the steps you have to do to send emails automatically from spreadsheets (Google Sheets)? very easily, you can follow the steps below:
  • Go to the Google Drive website.
  • Click New button, followed by the selection of Google Sheets.
    google sheet
  • Then write the data Email and Message as an example the following picture:
  • Then select Tools menu, then select Script editor sub menu.
  • Furthermore, after entering to form Script editor, copy and paste the following script:

function sendEmails() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 2;  // First row of data to process
  var numRows = 2;   // Number of rows to process
  // Fetch the range of cells A2:B3
  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 emails from a Spreadsheet";
    MailApp.sendEmail(emailAddress, subject, message);
  }
}

  • After you paste the above script as shown in the figure below, save it by clicking Save button (Floppy Disk image).
  • Next run the script followed by selecting Run menu option sendEmails script.
  • Then the process will be executed and the confirmation will appear as shown below, select Continue and followed the next selection by clicking Accept button.

    google sheet email
    google sheet email
Then the process of sending email based on the data that you write in Google Sheets will automatically be sent. Good luck.

He is a software developer; He try to write articles about the ideas, opinions, fantasies, experiences and desires related to IT issues and useful life; and He hopes everything that he write can be useful for the good of us all.

Share this

Related Posts

Previous
Next Post »