Articles on: FAQs

How to generate a webhook URL for Google Sheets

To create a webhook URL for a Google Sheet, you need to set up a Google Apps Script to handle the webhook request and then deploy it as a web app. Here are the steps:

Create a Google Sheet


Go to Google Sheets and create a new sheet or open an existing one.

Create a Google Apps Script


In your Google Sheet, click on Extensions > Apps Script.
Delete any existing code in the script editor and replace it with the following script:

function doPost(e) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var data = JSON.parse(e.postData.contents);
  
  // Assuming data is a simple key-value object, adjust according to your needs
  var row = [];
  for (var key in data) {
    row.push(data[key]);
  }
  
  // Append the new row at the bottom of the sheet
  sheet.appendRow(row);

  // Return a success message
  return ContentService.createTextOutput('Success');
}


Deploy the Script as a Web App


In the script editor, click on Deploy > New deployment.
Click on Select type and choose Web app.
Set the following:
Description: Provide a description, e.g., "Webhook for Google Sheet".
Execute as: Choose Me (your email).
Who has access: Choose Anyone (you may need to set this to Anyone with the link for public access).
Click Deploy.
Authorize the script by following the authorization prompts.
After deploying, you will get a URL. This is your webhook URL.

Use the Webhook URL


You can now use the webhook URL to send your Pop Convert collected data to your Google Sheet.
Add the web app url to Pop Convert webhooks

Updated on: 30/07/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!