Google Form adds rows to Sheet - how to be notified with each new row?

@Cyrus3v I was searching for a way to trigger my flow after each google form submission and came across your post.

I was able to solve for this by doing the following:

  1. Setup my Google Form (in Google) to notify me via email of each new submission.
  2. Setup a filter on my Gmail (in Google) to forward emails from google forms to a mailhook (in the webhook module in make)
  3. The mailhook has an instant trigger, so when it receives the forwarded email from my gmail it triggers the scenario, but since the trigger has none of the data from the Google Form, I actually use this trigger to send a make api call to make. See this post on the run scenarios via api.
    🔥 Feature Spotlight: Scenario Inputs, On-Demand Scheduling, Run Scenarios via API
  4. The scenario it triggers starts with a Google Forms module, which when triggered will find the most recent Google Form response and all the associated data which I can then use in the scenario.

This is quite a complicated workaround, especially for your use case, but maybe someone searching on how to do this in the future will find my response here helpful. If there is enough interest I can submit a showcase post on this with screenshots and blueprints.

EDIT: I found a much more efficient workaround thanks to ChatGPT code. Sharing here:

  1. Go to the Google Sheet that is linked to the Google Form, and in extensions, navigate to ‘apps script’

  2. See screenshot below. (Code is from ChatGPT so I can’t speak to how efficient it is but it works, code will be at the bottom of this post)

  3. Add the trigger so the code will run whenever the form is submitted

Good luck and I think this is the method I will use in the future if I need instant triggers from a Google Form.

const WEBHOOK_URL = "https://your-webhook-url.com";

function onFormSubmit(e) {
  // Get the form response data as a key-value map
  var formData = e.namedValues;

  // Convert the form data to a JSON object
  var data = {};
  for (var key in formData) {
    data[key] = formData[key][0];
  }

  // Prepare and send the HTTP request to the webhook
  var payload = JSON.stringify(data);
  var options = {
    method: "post",
    contentType: "application/json",
    payload: payload
  };
  UrlFetchApp.fetch(WEBHOOK_URL, options);
}

3 Likes