OutRightCRM: The Future of Smarter Customer Relationships
(+1) 858-682-5399 sales@outrightcrm.com
OutRightCRM Login
Published on August 16, 2024 Updated on April 23, 2025

With Google Sheets and...

Author Avatar
Ashish Dwivedi
Editorial Team

Send WhatsApp Message from Google Sheet in One-Click

With Google Sheets and Google Apps Script, you can send WhatsApp messages in one click using a pre-filled WhatsApp API link. Add the message and phone number in the sheet, create a custom button, and trigger a script that opens the WhatsApp chat automatically in a new browser tab.
  1. Step 1: Click on the Copy button to copy the code snippet.
  2. Step 2: Paste the copied code into your project’s script editor.

Apps Scripts Blog

Read Blog

Apps Scripts Code

function createWhatsAppHyperlink() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var lastRow = sheet.getLastRow();
  var dataRange = sheet.getRange(2, 1, lastRow - 1, 4); // Assuming data starts from row 2 and you have 4 columns (A, B, C, D)


  var data = dataRange.getValues();
  var whatsappLinks = [];


  for (var i = 0; i < data.length; i++) {
    var phoneNumber = data[i][1]; // Assuming phone numbers are in column B (index 1)
    var message = data[i][0] + " - " + data[i][2] + " - " + data[i][3]; // Merge data from columns A, C, and D
    var whatsappLink = "https://api.whatsapp.com/send?phone=" + phoneNumber + "&text=" + encodeURIComponent(message);
    var displayText = "click to send"; // The text you want to display as the hyperlink
    var hyperLinkFormula = '=HYPERLINK("' + whatsappLink + '", "' + displayText + '")';
    whatsappLinks.push([hyperLinkFormula]);
  }


  var columnE = sheet.getRange(2, 5, whatsappLinks.length, 1); // Column E (index 5) to store the hyperlinks
  columnE.setFormulas(whatsappLinks);


  Logger.log("WhatsApp hyperlinks with display text have been created successfully!");
}

Scroll to Top