To use this script, follow these steps:

  1. Open a Google Sheet that you want to receive webhook data in.
  2. Go to the “Tools” menu and select “Script editor.”
  3. Copy and paste the code I provided into the script editor.
  4. Save the script and close the script editor.
  5. Go to the external service that you want to set up a webhook with and configure it to send data to the endpoint URL of the Google Script project.
  6. Test the webhook by sending some sample data to the endpoint URL.

When the webhook receives data from the external service, it will write the headers and values to the active sheet in the Google Sheet. You can customize the script to write the data to a specific sheet or range in the Google Sheet if needed.

The code to paste in Google Apps Script section:

function doPost(e) {
  var sheet = SpreadsheetApp.getActiveSheet();
  var headers = e.parameter.headers.split(',');
  var values = e.parameter.values.split(',');
  // Write the headers to the first row of the sheet
  sheet.getRange(1, 1, 1, headers.length).setValues([headers]);
  // Write the values to the next row of the sheet
  // Return a success message
  return ContentService.createTextOutput("Webhook received successfully.");

Reach us if the process is unclear or if the script is outdated
Apps Scripts template


Last updated
Built by
Avatar Placeholder

This script sets up a webhook endpoint that receives data from an external service and writes it to a Google Sheet. When the webhook receives a POST request, it extracts the headers and values from the request body and writes them to the active sheet in the Google Sheet. It then returns a success message to the external service.