Sending Discord Notifications for Google Form Submissions (App Script)

blog image

Google Forms are powerful tools for collecting information from users and gathering feedback.

If you want to stay up-to-date with each form submission in real-time, you can integrate Google Forms with Discord, a popular messaging and collaboration platform.

In this tutorial, we’ll guide you through the process of setting up a Google Apps Script to send Discord notifications for every new Google Form submission, including the submitter’s email address.


  • A Google account to create and access Google Forms and Google Apps Script.
  • A Discord server to receive the notifications.
  • Basic knowledge of JavaScript and Google Apps Script.

Disclaimer:: When utilizing App Script to send Discord notifications via webhooks, it is crucial to be aware of the potential security implications. Storing the webhook link in plain text within the code poses a significant risk, as it could potentially be exposed to unauthorized access or malicious actors. In the event of a security breach, the webhook link could be exploited to send false or harmful messages to your Discord server. To enhance security, it is recommended to implement additional measures such as using encrypted storage or environment variables to store sensitive information, limiting access permissions, and regularly reviewing and updating the code to maintain the highest level of protection for your Discord server and data.

With that out of the way, here are the steps you need to follow 🙂

Step 1: Create a Discord Webhook

  1. Go to your Discord server.
  2. Click on the server settings (gear icon) and navigate to “Integrations” > “Webhooks.”
  3. Create a new webhook and customize it with a name and avatar if desired. Take note of the webhook URL as you’ll need it later.

Step 2: Set up the Google Form

  1. Create a new Google Form or open an existing one.
  2. Add the necessary form fields to collect the required information from users.

Step 3: Open Google Apps Script

  1. While editing your Google Form, click on the three dots in the top-right corner and select “Script editor.” This will open Google Apps Script in a new tab.

Step 4: Write the Script

Replace ‘DISCORD_WEBHOOK_URL’ in the following script with the webhook URL you obtained in Step 1.

// Replace 'DISCORD_WEBHOOK_URL' with your actual Discord webhook URL

function onSubmit(e) {
  const response = e.response;
  const itemResponses = response.getItemResponses();

  let message = "New Google Form Submission:\n";

  for (const itemResponse of itemResponses) {
    const question = itemResponse.getItem().getTitle();
    const answer = itemResponse.getResponse();
    message += `${question}: ${answer}\n`;

  // Get the submitter's email address
  const respondentEmail = response.getRespondentEmail(); // Use this if you're limiting form submission to logged in users only/users who compulsorily share an email address
  message += `Submitter's Email: ${respondentEmail}\n`; // Use this if you're limiting form submission to logged in users only/users who compulsorily share an email address


function sendToDiscord(message) {
  const payload = {
    content: message,

  const options = {
    method: 'post',
    headers: {
      'Content-Type': 'application/json',
    payload: JSON.stringify(payload),

  UrlFetchApp.fetch(DISCORD_WEBHOOK_URL, options);

Step 5: Save the Script and Set Up the Trigger

  1. Save the script and give it a name.
  2. Click on the “Triggers” icon (a clock-like icon) in the toolbar.
  3. Click on “Add Trigger” in the bottom-right corner.
  4. Set up the trigger as follows:
    • Choose which function to run: onSubmit
    • Choose which deployment should run: Head
    • Select event source: From form
    • Select event type: On form submit
  5. Save the trigger.


With this integration, every time a user submits the Google Form, the Google Apps Script will trigger and send a notification to your Discord server with the form submission details, including the submitter’s email address. You can also feel free to format the incoming Discord messages using their markdown syntax

This setup ensures that you can stay informed about new form submissions in real-time, making it easier to manage and respond promptly to the data collected through Google Forms. By following these steps, you can streamline your workflow and enhance your communication with your Discord community. Happy form collecting!

Liked this story? Share it with someone who needs to see it 👇