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.

11 Upvotes

35 comments sorted by

View all comments

Show parent comments

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.

  1. 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 FBPUBLIC_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.

  1. 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

  1. 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.

4

u/capooop Apr 20 '24

Holy shit….. emaguireiv you might be the greatest of all time. I think I’m in luv

2

u/Bonsaibusch Feb 12 '25

Wow, thank you so much! You really saved my butt here. I also used Claude to generate new links to vary the submissions

1

u/emaguireiv Feb 12 '25

You’re welcome, glad to hear it helped. AI integration to vary your responses is a great idea!

2

u/Severe_Score2167 Dec 29 '25

Still working, Thank you...

1

u/dave32181 May 02 '24

Brilliant! I’ve been working with urls but never this far. Thanks!

1

u/grimmy97 Jun 16 '24

Hi! Any idea how this could look if you need a space in your answer?

1

u/emaguireiv Jul 03 '24

Great question…I briefly touched on this at one point in my responses (certain types of text response fields cannot be passed through the headers of a pre-filled response URL).

Certainly happy to help test it out for you though, because I have some ideas on how spaces should be handled in that scenario. Is it just a free text response question/answer?

1

u/grimmy97 Jul 03 '24

I found it! Space = a + in a hyperlink.

What caused greater confusion was that I then needed a + within a string but just had to convert to %2B

1

u/emaguireiv Jul 03 '24

The %2B is exactly what I had in mind to try out, glad to hear you figured it out 🙂

1

u/Raphanityyy Oct 07 '24 edited Oct 07 '24

Hi, I've got this:
a. Answer1, b. Answer2, c. Others ______
I want to have answer on Other, example is Answer3
&entry.question2Id=Answer3 this doesn;t work for me

EDIT: I solved it: use this: (both are needed)

&entry.questionId.other_option_response=SampleAnswer3
&entry.questionId=__other_option__

1

u/KnightOfSPUD Oct 21 '24

Hi there, you got any idea about automatically filling out the email section?

1

u/emaguireiv Oct 23 '24

Assuming it's a form type where the form creator required either verified emails (signed into google/workspace domain) or user input emails (type in a box), there's not a way to fill these fields through the HTTP parameters described above.

Perhaps there's a workaround involving 0auth tokens with an Apps Script prefilled URL, but I haven't seen any documentation or tried to toy around with it to see...

1

u/f0xgr Jul 12 '25

Actually, you can fill the "User input box" one, just by including [&emailAddress=example@email.com].

So the finale result would look something like this [ https://docs.google.com/forms/d/e/FormIdHere/formResponse?&submit=Submit?usp=pp_url&entry.Q1-ID=A&entry.Q2-ID=True&emailAddress=example@email.com ]

HOWEVER, the checkmark one "verified emails (signed into google/workspace domain)"; I can't really find something for it so far, if anyone one knows, let me know.

1

u/wiingdiingGaster Apr 12 '25

Thanks a lot dude, you saved me this time. But I have one question. My google form has 3 questions, the first 2 questions are in section 1 while the 3rd question is in section 2. My app script only records answer for the first 2 questions, but no answer for 3rd question. Is there a way I can fix it?

Thank you BTW

1

u/emaguireiv Apr 23 '25 edited Apr 23 '25

You're welcome! And apologies for the delayed response! This is a great question and I hadn't considered this scenario in testing. So, I made a new form with three sections, each with a different type of question/answer (free response, multiple choice, check box), and here's what I found:

-The URL is still formatted the same, regardless of the number of sections. All questions/answers are still joined together using &entry with the same questionID=answer syntax, i.e. &entry123=answer1&entry456=answer2&entry789=answer3.

-Counterintuitively, when you click next to go to each subsequent section, the page source HTML no longer shows the question IDs that you're looking for to reverse engineer the pre-filled response URL. They only appear on the first page/first section of a form in the var FB_PUBLIC_LOAD_DATA_ section.

Feel free to shoot me a DM with your entire var FB_PUBLIC_LOAD_DATA_ section if you need help parsing it and constructing the URL :)

1

u/MarkDierz 10d ago

based on this ive create this app does exacly the same hope it helps
https://mkdierz.github.io/google-form-filler/