How-To: Execute A Workflow From A Google Sheet (using a webhook trigger)
Step 1: Set up your workflow
If your workflow begins with pulling data from a google sheet, make sure to reference the Google Sheets - Download Sheet to Workflows documentation, and ensure you’ve followed the steps to share your sheet with your Alli client’s Service Account.
You can also check out our popular workflow guides for inspiration like Popular Workflow: Google Sheet > Slack or check out our overview for a tutorial on how to use Workflows.
Step 2: Add a Webhook Trigger
In your workflow, open Triggers on the left side navigation.
Click Add Webhook.
Copy the webhook URL.
Treat this URL like a password. Anyone with access can trigger the workflow via POST.
If compromised, delete or regenerate the webhook. Old URLs will no longer work.
For more details, see How-To: Add & Manage Webhook Triggers.
Step 3: Create your Google Apps Script
In Google Sheets, click Extensions > Apps Script.
Rename the project for clarity.
Replace the default function with the code below.
Update
WEBHOOK_URL
with your webhook.
Click
Save
on the top
function sendWebhook() {
var url = "WEBHOOK_URL";
// Make POST request
var response = UrlFetchApp.fetch(url, {
method: "post",
muteHttpExceptions: true
});
// Status code
Logger.log(response.getResponseCode());
// JSON response
var json = JSON.parse(response.getContentText());
Logger.log(json);
}
Step 4: Create A Button to Initiate Your Script
In Google Sheets, click Insert > Drawing.
Design a button (shape, color, text).
Click Save & Close.
Select the button → More (⋮) > Assign Script.
Enter your function name from the above script. In the above example, our function is called
sendWebhook
, so we would place that in the input box.
Click OK.
Done! Now, clicking the button will trigger your workflow.
Tips:
The button is sensitive—accidental clicks will trigger it.
To move the button without triggering, right-click to bring up the resize handles (blue dots).
Place the button on a low-traffic tab (or its own sheet) to avoid unintended runs.
For a (longer) full overview, you can view this video: