How to integrate Google Sheet with Zapier's webhook

How to integrate Google Sheet with Zapier's webhook

Google Apps Script automation

Recently, I got one requirement to Integrate Google Sheet with Zapier's webhook. I'd never worked in both Google Sheet automation & Zapier previously. Also, first time get to know such things happen. It Almost took me 4-5hrs to make this happen.

What exactly do I need to do this - In Google Sheet, I need to add one button & whenever the user clicks on the button, the automation script fetches the data from the active cell of the Spreadsheet & send that to Zapier's webhook.

After googling a few minutes got to know about Google's "Apps Script", where one can write their JavaScript & hook up that with the Google Sheet to catch all the user events from Google Sheet.

Here are the steps you need to follow -

  • Open your google sheet & add some sample data.
  • Go to "Extensions -> Apps Scripts" as shown in the below fig.

Screenshot 2021-12-29 at 10.34.22 AM.png

  • Paste the below "sendValueBtn" function code inside the Apps Script editor.
function sendValueBtn() 
{
    var cellValue = SpreadsheetApp.getActiveSheet().getActiveCell().getValue();
    console.log('cell value is: ', cellValue);

    var webhookUrl = "Place-Your-WebHook-URL";

    var options = {
        "method" : "post",
        "payload" : {"celldata":cellValue}
    };

    let result = UrlFetchApp.fetch(webhookUrl, options);
    console.log('Webhook response: ', result);
}
  • Click on any cell from Google Sheet, which has some data & clicks on the "Run" button from Apps Script editor. You can see the output of the program in the editor itself.

Screenshot 2021-12-29 at 10.50.41 AM.png

  • Now, follow the given youtube tutorial to create a button on Spreadsheet & attach the "sendValueBtn" function to it.
YT tutorial: https://www.youtube.com/watch?v=e73I-5FkL7E
  • Inside the "sendValueBtn" function code, update the Zapier webhook URL. Check the GET/POST params name & value properly assigned in "sendValueBtn" function or not.
  • Click on any cell data in Spreadsheet. Now click on the newly created button on Google Sheet & see the action.

That's it. You can use Google Apps Script to do similar automation with other google tools also. For more check at here - developers.google.com/apps-script

To know more about such development information, follow me @ -