The form is multipaged, like this and I tried to use POST request, but it works only for one-paged form, check this subject. Maybe there are another ways?
2 Answers
Try this code.
WebClient client = new WebClient();
var nameValue = new NameValueCollection();
nameValue.Add("entry.xxx", "VALUE");// You will find these in name (not id) attributes of the input tags
nameValue.Add("entry.xxx", "VALUE");
nameValue.Add("entry.xxx", "VALUE");
nameValue.Add("entry.xxx", "VALUE");
nameValue.Add("pageHistory", "0,1,2");//Comma separated page indexes
Uri uri = new Uri("https://docs.google.com/forms/d/e/[FORM_ID]/formResponse");
byte[] response = client.UploadValues(uri, "POST", nameValue);
string result = Encoding.UTF8.GetString(response);
I tried this with 3 pages. You can have any number of pages "i guess". This will submit the data directly and return "Success page from google forms".
EDIT
I Have not worked with google forms "like never", so was not able to find a proper way to do this if there is any, but this seems to work just fine.
Append this to your uri for multiple checkboxes
?entry.xxxx=Option+1&entry.xxxx=Option2
entry.xxxx remains same for one question if you have multiple questions with check boxes then it would change to this
?entry.xxx=Option+1&entry.xxx=Option2&entry.zzz=Option+1&entry.zzz=Option2
value is the lable of your check box replace (whitespace) with (+) plus if any like in (Option 1)

- 116
- 7
-
1Maybe you also know how to set checked more than one checkboxes in a question? – Askarovich Sep 19 '18 at 13:59
Puneet's answer was the only answer I've found on how to deal with checkboxes with multiple values. I tried to find a way to put multiple checkbox values in the body of the response instead of in the URL but could not.
In the spirit of his answer, I've made a GoogleFormSubmissionService
in C# to make dealing with Google Forms easy in C#.
You can find it on my Gist here: Google Forms Submission Service in C#

- 3,178
- 2
- 32
- 38
-
I'm struggling with Radio boxes instead of checkboxes. Any suggestion on handling Radios? – DoomerDGR8 May 18 '20 at 09:53
-
I asked my question here: https://stackoverflow.com/q/61849716/481656 – DoomerDGR8 May 18 '20 at 10:48
-