Click here to Skip to main content
12,503,749 members (29,476 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked

How to Submit Google Docs Form by using C#

, 21 Sep 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Submitting (HTML) specifically Google Docs Form in C#

Step 1


First create your form in Google doc.

Step 2

Open the form and check the source to find this line, and copy the Action parameter value:

<form action=;ifq 
method="POST" id="ss-form"> 

Step 3

Use this method to submit a new entry in your C# code (this example is for a form with two textboxes):

void SubmitGoogleDoc(){
            //Use WebClient Class to submit a new entry
            WebClient wc = new WebClient();
            var keyval = new NameValueCollection();
            keyval.Add("entry.0.single", "XXXX");
            keyval.Add("entry.1.single", "XXXX");
            keyval.Add("submit", "Submit");
            //Create an event for Submit Complete
            wc.UploadValuesCompleted += 
            new UploadValuesCompletedEventHandler(wc_UploadValuesCompleted);
            //Create Additional Headers  
            wc.Headers.Add("Origin", "");
            wc.Headers.Add("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) 
            AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10");
            //Finally Submit the Form:
            wc.UploadValuesAsync(new Uri
            "POST", keyval, Guid.NewGuid().ToString());
void wc_UploadValuesCompleted(object sender, UploadValuesCompletedEventArgs e)
    //Submit Complete


Hope this small tip will make you happy. Smile | <img src=


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ghasem Heyrani Nobari
Software Developer (Senior)
Iran (Islamic Republic of) Iran (Islamic Republic of)
Ghasem - Heyrani-Nobari

You may also be interested in...


Comments and Discussions

QuestionDidn't work, but have other solution Pin
Member 1172917229-May-15 9:33
memberMember 1172917229-May-15 9:33 
Questionhei :) Pin
Gun Gun Febrianza16-Oct-12 17:00
memberGun Gun Febrianza16-Oct-12 17:00 
GeneralMy vote of 5 Pin
Gun Gun Febrianza16-Oct-12 17:00
memberGun Gun Febrianza16-Oct-12 17:00 
GeneralMy vote of 1 Pin
Jackssen27-May-12 16:05
memberJackssen27-May-12 16:05 
GeneralRe: My vote of 1 Pin
Ghasem Heyrani Nobari21-Sep-12 18:51
memberGhasem Heyrani Nobari21-Sep-12 18:51 
GeneralJust tried this and it is not working... It returns success... Pin
Adam Haile9-Dec-11 18:14
memberAdam Haile9-Dec-11 18:14 
GeneralRe: Just tried this and it is not working... It returns success... Pin
Ghasem Heyrani Nobari21-Sep-12 18:49
memberGhasem Heyrani Nobari21-Sep-12 18:49 
GeneralReason for my vote of 5 good one Pin
Pranay Rana7-Jan-11 0:00
memberPranay Rana7-Jan-11 0:00 
GeneralHtml Forms Pin
Ghasem Heyrani Nobari6-Jan-11 23:41
memberGhasem Heyrani Nobari6-Jan-11 23:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160919.1 | Last Updated 21 Sep 2012
Article Copyright 2011 by Ghasem Heyrani Nobari
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid