Submit Google Forms by curl command

Google Forms is a very common way to collect user data nowadays. After you have created the form, you could insert it to your web site and present it with your own style.

Other than that, we could integrate Google Forms with the backend job since we could submit the form through command line. Let’s take a look on the following example.

1. Create a new form on your Google drive. The edit page url should be in the following format.

  • https://docs.google.com/forms/d/<form-id>/edit

 

2. View the live form and inspect your field elements to get all the field name.
submit-google-form-by-command-1
 

3. Construct the curl command as follow:

  • curl https://docs.google.com/forms/d/<form-id>/formResponse -d ifq -d <field-name>=<field-value> -d submit=Submit

 

In my case the curl command is

  • curl https://docs.google.com/forms/d/1XEJWxStJhNhfv_smf9pzQxEBbXMjhyuRyp7aHXuDjRY/formResponse -d ifq -d entry.1202908243=Eureka -d submit=Submit

 

4. Execute it in shell and that return your the submitted successfully html.
submit-google-form-by-command-2
 

5. If your <field-value> contains special characters like whitespace, wrap the key value pair with double quote.

12 thoughts on “Submit Google Forms by curl command”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.