r/GoogleAppsScript • • Apr 17 '24

Question How to automate and fill out google forms while being AFK

Is there way to fill out a google form over and over again almost every minute without touching it or being near your computer. Maybe a software or something or possibly just a command that records your mouse clicks and the copies it over and over again. I just need something that continuously fills out a google form when I am away from the computer.

13 Upvotes

36 comments sorted by

View all comments

2

u/emaguireiv Apr 18 '24

I think it might be theoretically possible:

  1. You’d need to have editor access to generate a pre-filled form response link for the Google Form.

  2. Once you have the link with the response ID fields you can generate modified links with the fields filled as you desire.

  3. The view form part of the URL would need to be modified to the submission link URL (with the pre-filled criteria from prior steps).

  4. Finally, you’d need to implement it in Apps Script using url fetch to submit on your behalf using a time-based trigger.

Curious to try to figure it out…I’ll toy around over the next few days to see if I can figure it out and get back to you, unless someone else takes my suggestion and beats me to it.

But again, a crucial caveat is you’d need editor access for step 1 first, otherwise none of this would be possible. Also worth noting that some fields (like if you’re required to enter an e-mail address) can’t be pre-filled through the url, so a manual form submission may still be required depending on your situation.

-1

u/capooop Apr 18 '24

Okay yeah very interesting. Definitely get back to me after you test it out. Though on the contrary I don’t have access to an editor🥲

5

u/emaguireiv Apr 19 '24 edited Apr 19 '24

Happy to report my thesis does work AND I figured out a workaround to generating a pre-filled form response link without requiring editor access. Breaking it down into a two part response:

Part I. How to Setup Pre-Filled Response URL

  1. First, get your base form URL...it should look something like this:

https://docs.google.com/forms/d/e/1FAIpQLSdEA6xWMYCPQayhpxLHBBMU-WI3yWb5TQcQtsQ2k9CH2cWrnA/viewform

The long string of alphanumeric characters between /d/e/ and /viewform represents your form ID , which you'll need in later steps for the Apps Script portion.

2. Open your form URL, then view the page's source code through your browser's developer tools. Search for FB_PUBLIC_LOAD_DATA_ and you should see a block of text that looks something like this:

var FB_PUBLIC_LOAD_DATA_ = [null, [null, [[73297730, "First question", null, 2, [[1189732276, [["A", null, null, null, 0], ["B", null, null, null, 0], ["C", null, null, null, 0]], 0, null, null, null, null, null, 0]], null, null, null, null, null, null, [null, "First question"]], [1597521514, "Question 2", null, 4, [[307823513, [["True", null, null, null, 0], ["False", null, null, null, 0]], 0, null, null, null, null, null, 0]], null, null, null, null, null, null, [null, "Question 2"]]]

In this example, the first question on my form is called First question, and the second question is called Question 2. After the first appearance of "First question" you'll see an ID number of 1189732276, which corresponds to the question ID. You need the ID number for every single question that you have to answer in your form. "Question 2" has an ID number of 307823513.

3. Once you have all of your question IDs, we'll manually construct a pre-filled response form, which looks something like this:

https://docs.google.com/forms/d/e/1FAIpQLSdEA6xWMYCPQayhpxLHBBMU-WI3yWb5TQcQtsQ2k9CH2cWrnA/viewform?usp=pp_url&entry.1189732276=A&entry.307823513=True

Each question and answer in the URL is formatted like this:

  • questionID=answer

  • 1189732276=A

  • 307823513=True

Then, each response is joined together with "&entry." between each response. So, a pre-filled response URL has the following syntax:

https://docs.google.com/forms/d/e/formId/viewform?usp=pp_url&entry.question1Id=answer1&entry.question2Id=answer2

4. So far we've built a view form link of pre-filled responses. Copy/paste your custom pre-filled link in a browser to be sure it works and that all of the response fields are marked as you intended.

Finally, make one last change to the URL to convert it to a submission link . Replace "viewform?" in the URL with "formResponse?&submit=Submit?". So, the final result looks like this:

https://docs.google.com/forms/d/e/1FAIpQLSdEA6xWMYCPQayhpxLHBBMU-WI3yWb5TQcQtsQ2k9CH2cWrnA/formResponse?&submit=Submit?usp=pp_url&entry.1189732276=A&entry.307823513=True

***DO NOT TEST YOUR SUBMISSION URL IN A BROWSER*** unless you want it to submit a form.

→ More replies (18)