all 18 comments

[–]Kristler 6 points7 points  (6 children)

I'm quite surprised at how many people are suggesting automation based approaches. It's actually a pretty simple solution.

Hop to your form page, and click Responses > Get pre-filled URL. It'll ask you to do a sample fill-out of your form. I'd suggest putting in responses that easily let you see what question you're answering. Once you hit submit, it's going to give you a URL in the form of...


Now, change viewform to formResponse within the URL. If you POST to this URL, it'll submit the form using the options chosen with whatever those entry parameters are set to. I'd suggest using the requests module and building a dict of entry.____ : value pairs and then passing it as the params argument.

EDIT: Thank you to /r/sinksanksunk for catching a change in Google Forms.

[–]Flamewire 0 points1 point  (1 child)

This seems the most promising. Thank you!

[–]Kristler 0 points1 point  (0 children)

No problem! It was a problem I ran into a few months back. Let me know if you run into any issues.

[–]sinksanksunk 0 points1 point  (3 children)

I imagine that /u/Flamewire has figured this out by now, but just for reference for everyone else, I think the correct URL format is to substitute formResponse for viewform. So the url that you submit with requests.post(url,data) should look like


[–]Kristler 0 points1 point  (2 children)

Is there something wrong with my answer that I'm not aware of?

[–]sinksanksunk 0 points1 point  (1 child)

I get a 405 code when I submit using viewForm in the URL, the Google doc doesn't take the submission. The formResponse in the URL actually submits to the doc. Unless I'm interpreting your answer incorrectly. But I can actually get the formResponse to work.

On mobile now, I can submit clearer code later

[–]Kristler 0 points1 point  (0 children)

Ain't that the darndest thing. At one point in the near past, a getting the pre-filled URL gave you a formResponse, not a viewform. You're absolutely correct, thanks for catching this.

[–]tomislava 4 points5 points  (0 children)

my guess is that google has an interest in not allowing automated form filling, so they're going to try to stop you from doing this by adding a nonce to each submission or something else involving cryptography.

you could write a macro using sendkeys to directly fill out the form in the browser, but you would probably get shut out for submitting forms faster than a human can.

either that, or you're working on your own data and forms and aren't using them correctly. if that's the case try looking at their documentation or pasting that error into google.

[–]glemnar 3 points4 points  (3 children)

Well, you're missing grid_id in your url query string. Seems pretty clear no?

[–]Flamewire 0 points1 point  (2 children)

The thing is, I don't know what that means. Searching the error message hasn't helped; it apparently shows up when one uses capital letters in column names, which isn't my problem here.

[–]glemnar -1 points0 points  (1 child)

[–]autowikibot 1 point2 points  (0 children)

Query string:

In the World Wide Web, a query string is the part of a uniform resource locator (URL) containing data that does not fit conveniently into a hierarchical path structure. The query string commonly includes fields added to a base URI by a Web browser or other client application, for example as part of an HTML form.

A web server can handle a Hypertext Transfer Protocol request either by reading a file from its file system based on the URL path or by handling the request using logic that is specific to the type of resource. In the case that special logic is invoked the query string will be available to that logic for use in its processing, along with the path component of the URL.

Interesting: Entrez | Uniform resource locator | Question mark



Have a look at the selenium web driver, I believe that there is a python version of this framework and honestly it could be your best bet for filling them in if they are web based forms.

Once you've submitted the forms you'll then be able to scrape the results pages for results and then pass this to wherever it needs to go.

[–]MinimalDamage 1 point2 points  (0 children)

Yes, I agree. Selenium is a safe and sure bet when it comes to any web forms.

[–]KidA001 0 points1 point  (0 children)

Look into using nokogiri and mechanize, I believe they have packages for python. Its made to navigate the DOM and submit forms

[–]fatjakep 0 points1 point  (1 child)

I've recently had to do this exact thing. I'm relatively new to all this though and so I'm not sure how my solution compares to others here.

You're going to want to POST a submission to the form response URL.

First, get the form response URL. It can be found by substituting your form ID into the following:


Your form ID can be found by going to your live form (the one where you'd manually input a response) that looks like


and take the form ID string from there.

Second, build the submission. This will be a dictionary with keys being the IDs of the form questions and the values being what you'd like to submit.

To get the IDs, again go to your live form and inspect the html elements (right-click > Inspect Element in Chrome) where you'd normally input your data. You should find a bunch of ss-form-entry objects with name attribute like


Populate your dictionary as follows:

submission = {"entry.<id>": <value>}

Third, and finally, you should be able to POST this with

import requests
requests.post(url, submission)

If you're interested, my (messy) solution for doing this can be found here. You'll find the relevant code in the submit() method of the Form() class.

Let me know how you get on!

[–]Flamewire 0 points1 point  (0 children)

Thanks! I appreciate the detail.

[–]andrewsmd87 -3 points-2 points  (0 children)

Download imacros for firefox create a macro that fills that out. You can then write a script that calls that imcro from command line and execute that.

If you look at the imcaro text file, you can see fairly easy how to "code" a macro in FF. Then, you can write code that writes the imcaro script before you call it to make it dynamic.

I did a senior project on this years ago and skewed the fuck out of some online polls.

Note, you'll be f'd if the form has any sort of captcha (which are made to prevent exactly what you're trying to do).

I was once dating a girl who said I didn't text or call her enough. So, I created an imcro that logged into my verizon account and sent a text online. I then wrote a script that would change that imcaro value of that imcart text file to set the text box that sent the text to i don't text enough message 1, i don't text enough 2, i don't text enough 3, etc. I then scheduled that script to run every hour, 24 hours a day. She quit complaining after a couple days.