WhatsTool Business
Signup / LoginSupportBlog
  • Get started with WhatsTool Business
  • 📌WHATSTOOL BUSINESS
    • Create an account in WhatsTool Business.
    • How to connect your number to WhatsApp API ?
    • WhatsTool Business Demo - Complete Walkthrough
    • Quick Short Videos
  • 📖Meta Guide
    • Q&A Best Practices
      • 1. How to verify facebook business account ?
      • 2. How to see quality score ?
      • 3. How to apply for green tick ?
      • 4. How often phone number status changes ?
      • 5. What are the types of error code for failed message ?
      • 6. How to request review to enable the business manager account ?
      • 7. Template guidelines
      • 8. How to Edit display name and delete the Whatsapp API Number ?
      • 8. How to disable 2FA in the Meta
    • Frequently asked questions
    • Q&A Best Practices
  • 🈁CHATS
    • WhatsTool Business Chats Guide
    • Shared Inbox
    • Reply Box
    • Q&A Best Practices
      • 1. How to initiate a new chat ?
      • 2. How to send a template ?
      • 3. How to send a catalog product ?
      • 4. How to send a quick reply ?
      • 5. How to request payment ?
      • 6. How to add private note ?
      • 7. How to assign label, team member & status in chat ?
      • 8. How to send multiple media in chat ?
      • 9. How to assign labels, custom field & status in bulk ?
      • 10. How to use click to chat ?
    • Efficiently using Chats
  • 📕CONTACTS & CRM
    • WhatsTool Business Contacts guide
    • Features
      • Labels
      • Custom Field
      • Status
      • Quick Reply
    • Q&A Best Practices
      • 1. How to import CSV to add Contacts ?
      • 2. How to add contacts manually ?
      • 3. How to start campaign by selecting contacts ?
      • 4. How to edit the contacts ?
    • Efficiently using Contacts & CRM
    • Frequently asked questions
  • 📣CAMPAIGN
    • WhatsTool Business Campaign guide
    • Broadcasting the message
    • Campaign Analytics
    • Q&A Best Practices
      • 1. How to create a campaign ?
      • 2. How to schedule a campaign ?
      • 3. How to send session message in bulk ?
      • 4. How to retarget the customer using analytics ?
    • Efficiently using the Campaign
    • Frequently asked questions
  • 🤖BOTS
    • WhatsTool Business Bot guide
    • Ask Questions
      • Ask Email
      • Ask Text
      • Ask Date
      • Ask Number
      • Ask Address
      • Ask URL
      • Ask Location
      • Ask Phone
    • Bot Actions
      • Assign Conversation
      • Update Contact Fields
      • Unassign Conversations
      • Update Conversation Fields
    • Set up Default Bot
    • Q&A Best Practices
      • 1. How to create my customise bot message ?
      • 2. How to get the feedback using the bot and retrieve the data in Google sheet ?
    • Efficiently using the Automation
    • Frequently asked questions
  • 🛒COMMERCE
    • WhatsTool Business Commerce guide
    • Connect the Catalog with Meta
    • Q&A Best Practices
      • 1. How to connect my catalogs in WhatsApp API ?
      • 2. How to create a catalogue ?
      • 3. How to add product items to catalogue ?
    • Frequently Asked Questions
    • Efficiently using the Ecommerce
  • 📄TEMPLATES
    • WhatsTool Business Templates guide
    • Q&A Best Practices
      • 1. How to create a template ?
    • Efficiently using Templates
    • Frequently asked questions
  • 🛠️SETTINGS
    • WhatsApp API Number
      • 1. How to update the whatsapp profile ?
    • Manage Team
      • 2. How to add team member in WhatsTool Business ?
      • 3. How to assign team member in assignment rule ?
    • Media Gallery
  • 💰Pricing
    • WhatsApp Conversation Credit (WCC)
    • WhatsTool Platform Pricing
    • Team Member - Add-Ons
  • 🖇️App Integration
    • Google Sheet
    • Zoho CRM
    • Pabbly Integration
    • Razorpay
    • Page
    • Shopify
    • Facebook Ads
  • 👨‍💻API DOCS
  • Miscellaneous
    • WhatsApp Business API - Unsupported Messages
    • Commonly asked questions in support
Powered by GitBook
On this page

Was this helpful?

  1. App Integration

Google Sheet

Google Sheets is a cloud-based spreadsheet software developed by Google . It offers a wide range of features for creating, editing, and collaborating on spreadsheets in real-time.

PreviousTeam Member - Add-OnsNextZoho CRM

Last updated 1 year ago

Was this helpful?

GSheet Integration

Google Sheets offers various ways to integrate with other services and tools to enhance functionality and automate tasks. Here are some common methods for Google Sheets integration:

Follow these Steps:

  1. Open the Google Sheets

  2. Click on Extensions

  3. Open the App Script and paste the Below Code.

  4. Google Apps Script: Google Apps Script is a JavaScript-based scripting language that allows you to automate tasks and extend Google Workspace (formerly G Suite) applications. You can use Google Apps Script to create custom functions, automate data import/export, and even build custom menu options within Google Sheets. To get started, go to "Extensions" -> "Apps Script" within Google Sheets.

  1. Google Sheets API : The Google Sheets API allows you to programmatically access and modify Google Sheets data. This is more advanced and requires coding skills. You can use the API to read and write data, format cells, and perform various operations on your Google Sheets. Documentation and examples can be found on the Google Sheets API documentation.

Copy this Code and Paste in App Script

function onEdit(e) {

  editFun(e)

}

function onChange(e) {

  var sheet = SpreadsheetApp.getActiveSheet();

  var range = sheet.getActiveRange();

  var row = range.getLastRow();

  SpreadsheetApp.getActiveSpreadsheet().toast(">" + e.changeType + " " + row + " " + sheet.getName());

}

function editFun(e) {

  var range = e.range;

  Logger.log("hello this is onEdit");

  const as = e.source.getActiveSheet();

  const name = e.source.getActiveSheet().getName();

  console.log("postDataValue: ", name)

  //Step 1 : Set your Trigger Value 
  var triggerValue = 6

  if (name == "Sheet1" && e.range.columnStart == triggerValue) {

    var row = e.range.rowStart;

    console.log("rangeData: ", e.range.columnStart)

    var headers = getHeadrs(triggerValue)

    console.log("headers: ", headers)

    var data = {}

    for (let i = 0; i < triggerValue; i++) {

      data[headers[0][i].toString()] = as.getRange(row, i + 1).getValue().toString()

    }

    console.log("rangeDataDetails: ", data, `${data["Name"]}`)

    if (Object.keys(data).length > 0) {

      const payload =

      //Step 2 : Paste your Template Json here       
      {

        "to": `${data["Phone"]}`,

        "type": "template",

        "template": {

          "id": "1370745846809427",

          "namespace": "ae3cbb41_4ec3_48af_9a58_68a1c0332ce6",

          "language": {

            "code": "en"

          },

          "name": "ca",

          "components": [{ "type": "header", "parameters": [{ "type": "image", "image": { "link": "https://storage.googleapis.com/wtx_public_bucket_prod/1696485239038.png" } }] }, { "type": "body", "parameters": [{ "type": "text", "text": "Shashi" }] }]

        }
      }

    

    const options = {

          method: 'POST',

          // followRedirects: true,

          // muteHttpExceptions: true,

          payload: JSON.stringify(payload),

          contentType: 'application/json',

          headers: {

            //Step 3 : Paste your API Key here 
            "x-api-key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJidXNpbmVzc0lkIjoiNjJjODFiZWM3MTVlOGRlYTZlYjQ2MjcyIiwia2V5VmVyc2lvbiI6Ind0Yl85MjMwZmE1NTQxMGUiLCJpYXQiOjE2OTA1Mzg1NzB9.tCIUxL5xZdb1SLU5BjAbNpYuOLgbgjX6Y8dvDTSHPqM",

            "content-type": "application/json"

          }

        };

        try {
          //Step 4: Paste your API number below & remove the bracket
          const res = UrlFetchApp.fetch("https://api.whatstool.business/developers/v1/messages/{Paste your API Number}", options).getContentText()

      console.log("UrlFetchAppResponse: ", JSON.stringify(res))

        } catch(e) {

          console.log("UrlFetchAppError: ", e)

        }

      }

      console.log("postDataValue: ", data)

    }

  }


function getHeadrs(e) {

  return header = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()

    .getRange(1, 1, 1, 6).getValues();

  // console.log("headers: ", header[0].toString())

}

Steps 1 : In this you need to Change the Trigger Value in Which Column the Data Ends take that count and enter it as Trigger value.

Step 2 : Copy the Template JSON from WhatsTool **Go to WhatsTool Business > Settings > Templates > Select the Template > Copy the JSON.

Step 3 :** Change The API Key Go to WhatsTool Business > Settings > Developers API > Generate the API Key and Copy that

Step 4 : Kindly Click on Triggers and Change the status as below Image and Save.

Step 5 : Kindly Add new Entry in the Excel Sheet.

Step 6 : Click on Execution to check the Logs of the message Triggered.

Kindly refer the below video for better understanding

🖇️
Code for Gsheet
Trigger Config