Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Submit form data to your Google Form from dotnet C# with ease! ;) #GoogleFormsToolkitLibrary
/// <summary>
/// Submit Form data to your Google Form
/// </summary>
/// <param name="yourGoogleFormsUrl">
/// Link to your Google Form page
/// </param>
/// <param name="formData">
/// Form data dictionary to submit
/// TKey: FieldSubmissionId - TValue: Value
/// </param>
/// <returns></returns>
public async Task<bool> SubmitToGoogleFormAsync(string yourGoogleFormsUrl, Dictionary<string, string> formData)
{
// Init HttpClient to send the request
HttpClient client = new HttpClient();
// Encode object to application/x-www-form-urlencoded MIME type
var content = new FormUrlEncodedContent(formData);
// Post the request (replace with your Google Form link)
var response = await client.PostAsync(
yourGoogleFormsUrl,
content);
if (response.StatusCode == System.Net.HttpStatusCode.OK)
return true;
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.