Google-apps-script – Fill out google form using an api

google-apps-scriptgoogle-forms

I have a private google form I need to fill out every day, so I would like to write a script to authenticate me using my google credentials, and then fill out some of the form programatically, is there an API for that? What is a recommended approach for this, without having edit access to the form?

Best Answer

I know this answer is super-late, but I just found your question via google since I had the same thought. The answer is query parameters. According to this article about using merge tags in Mailchimp to auto-populate google forms, if you pass query parameters after the form URL in the format form.url?key=value, e.g.https://docs.google.com/forms/path/to/stub?<entry.###########>=<url-encoded prefill value>. After generating the form, inspect the field you want to prefill. Its name attribute will be in the format <entry.###########>, where .###########> is some long number. Fill in <url-encoded prefill value> with whatever you want to go into that form, as long as it is properly URL-encoded. Hope that helps anyone else with the same question as us.