Stay organized with collections
Save and categorize content based on your preferences.
The Google Forms API lets you retrieve form content, settings and metadata,
and the end-user form responses. This page describes how to perform these
tasks.
Before you begin
Perform the following tasks before proceeding with the tasks on this page:
Complete authorization/authentication and credentials setup in the
Early Adopter Program instructions.
Retrieve form contents and metadata
To retrieve the content, settings, and metadata of a form, call the
forms.get() method with the
form ID.
fromapiclientimportdiscoveryfromhttplib2importHttpfromoauth2clientimportclient,file,toolsSCOPES="https://www.googleapis.com/auth/forms.body.readonly"DISCOVERY_DOC="https://forms.googleapis.com/$discovery/rest?version=v1"store=file.Storage("token.json")creds=Noneifnotcredsorcreds.invalid:flow=client.flow_from_clientsecrets("client_secrets.json",SCOPES)creds=tools.run_flow(flow,store)service=discovery.build("forms","v1",http=creds.authorize(Http()),discoveryServiceUrl=DISCOVERY_DOC,static_discovery=False,)# Prints the title of the sample form:form_id="<YOUR_FORM_ID>"result=service.forms().get(formId=form_id).execute()print(result)
fromapiclientimportdiscoveryfromhttplib2importHttpfromoauth2clientimportclient,file,toolsSCOPES="https://www.googleapis.com/auth/forms.responses.readonly"DISCOVERY_DOC="https://forms.googleapis.com/$discovery/rest?version=v1"store=file.Storage("token.json")creds=Noneifnotcredsorcreds.invalid:flow=client.flow_from_clientsecrets("client_secrets.json",SCOPES)creds=tools.run_flow(flow,store)service=discovery.build("forms","v1",http=creds.authorize(Http()),discoveryServiceUrl=DISCOVERY_DOC,static_discovery=False,)# Prints the responses of your specified form:form_id="<YOUR_FORM_ID>"result=service.forms().responses().list(formId=form_id).execute()print(result)
fromapiclientimportdiscoveryfromhttplib2importHttpfromoauth2clientimportclient,file,toolsSCOPES="https://www.googleapis.com/auth/forms.responses.readonly"DISCOVERY_DOC="https://forms.googleapis.com/$discovery/rest?version=v1"store=file.Storage("token.json")creds=Noneifnotcredsorcreds.invalid:flow=client.flow_from_clientsecrets("client_secrets.json",SCOPES)creds=tools.run_flow(flow,store)service=discovery.build("forms","v1",http=creds.authorize(Http()),discoveryServiceUrl=DISCOVERY_DOC,static_discovery=False,)# Prints the specified response from your form:form_id="<YOUR_FORM_ID>"response_id="<YOUR_RESPONSE_ID>"result=(service.forms().responses().get(formId=form_id,responseId=response_id).execute())print(result)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-19 UTC."],[[["The Google Forms API allows you to programmatically access and retrieve form content, settings, metadata, and user responses."],["You can retrieve form content and metadata by calling the `forms.get()` method with the form ID."],["To retrieve all form responses, use the `forms.responses.list()` method with the form ID."],["Individual form responses can be retrieved using the `forms.responses.get()` method, providing both the form ID and the specific response ID."],["Before using the API, ensure you have completed the necessary authorization, authentication, and credential setup outlined in the Early Adopter Program instructions."]]],[]]