How to submit responses to a Google Form using Apps Script?

In this tutorial, I will show you how to submit a response to a Google Form using Google Apps Script.


This tutorial assumes that you're familiar with:

N steps to submit a response to a Google Form using Apps Script

Step 1 — Create a Google Form

In order to submit responses to a Google Form, we need to first create the form. If you already have a form, please open it. If not, please create one. In this tutorial, I will use a form containing four questions:

  • Name: Name of the person signing up for a fun activity

  • Email address: Their email address

  • Fun activity preference: Their preferences for fun activities they'd like to participate in

  • Dietary preferences: Dietary restrictions that they may have

Screenshot of a Google Form.

Once you create your Google Form, the next step is to get a pre-filled link. A pre-filled link is a link that will pre-fill responses to some or all of the questions in the form.

If you can predict the "likely" response a specific user will enter for a question, you can pre-fill that response to save the user time. In our case, we will be using these pre-filled links to extract information that will help us go one step further and automatically submit information to the Google Form using Apps Script.

The steps to get the pe-filled link are:

  • Select the "three dots" ( ⠇) menu on the form that you see on the right hand side of the Send button.

  • Select the Get pre-filled link menu item. This will open the form in a new tab (or a new browser window).

  • Enter a sample response to each question on the form.

  • Click the Get link button at the bottom of the form.

  • A toast notification will appear on the screen that will allow you to copy the link to pre-fill the form with the responses you entered previously. Click the COPY LINK button on that notification to copy the link to your clipboard.

The video below demonstrates how to complete the above steps.

Once you complete the steps to get the pre-filled link, you should have it saved in your clipboard. Paste the link somewhere where you can retrieve it later. We will be using this link in step 3 of this tutorial.

The link should look like this:<FORM_ID>/viewform?usp=pp_url&entry.240448027=Name&

Each of the URL parameters that start with "entry" correspond to a field in the form. For example, in the above URL the parameter entry.240448027 is for the Name field. The parameter entry.692437909 is for the email address field, and so on.

The image below illustrates how the URL parameters map to the fields on the form I am using in this tutorial. The parameters will be different for your form so you'll need to create this mapping once you get the pre-filled link for your form.

The final step is to submit a response to the Google Form via a GET request made using UrlFetchApp. To do this we need to make two changes to the URL:

1. Replace viewForm in the URL with formResponse

The original URL is the one below. Replace viewForm with formResponse.

The modified URL should look like the following:

2. Replace the placeholder values for each form field with the actual values you want submitted

The URL is currently configured to enter the placeholder values that you entered while creating the pre-filled URL. Please replace these parameters in the URL with the actual ones that you want to submit.

If you decide not to submit an "other" entry for dietary preferences, please delete the corresponding parameters:

Submit your entry to the Google Form using Apps Script

The final step is to submit your entry to the Google Form using Apps Script. The function submitEntryToGoogleForm() makes a GET request which submits the entry to the Google Form.

function submitEntryToGoogleForm() {

  let url = "<FORM_ID>/formResponse?usp=pp_url&entry.240448027=Jake+Miles&";
  let response = UrlFetchApp.fetch(url);


Here is a video demonstrating the submission:

That's it, you successfully submitted a response to a Google Form using Apps Script.


In this tutorial, you learned how to programmatically submit responses to a Google Form using UrlFetchApp in Apps Script.

Hope this tutorial helped you and thanks for reading!

Stay up to date

Follow me via email to receive actionable tips and other exclusive content. I'll also send you notifications when I publish new content.
By signing up you agree to the Privacy Policy & Terms.

Have feedback for me?

I'd appreciate any feedback you can give me regarding this post.

Was it useful? Are there any errors or was something confusing? Would you like me to write a post about a related topic? Any other feedback is also welcome. Thank you so much!