Skip to content

This repository contains a Python script that fetches responses from a Google Form using the Google Forms API

Notifications You must be signed in to change notification settings

muthu-kumar-u/google-forms-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Google Forms API Response Fetcher

This Python script fetches responses from a Google Form using the Google Forms API and stores them in data.json.

Prerequisites

  1. Install Python 3 if not already installed.
  2. Install the required dependencies:
    pip install -r requiement.txt
  3. Set up Google Cloud credentials:
    • Create a project in the Google Cloud Console.
    • Enable the Google Forms API.
    • Download credentials.json from the Google Cloud Console and place it in the project directory.

Usage

  1. Run the script:
    python main.py
  2. The script will fetch all responses from the specified Google Form and append them to data.json.

Code Functionality

  • Authenticates using OAuth2 and stores the token in token.json.
  • Fetches metadata of the specified form.
  • Retrieves all responses to the form.
  • Loops through all responses and appends them to data.json.

Expected Output

A data.json file containing:

{
    "responses": [
        {
            "responseId": "abc123",
            "answers": { "question1": "answer1", "question2": "answer2" }
        },
        ...
    ]
}

Notes

  • Ensure credentials.json is correctly configured.
  • Update the form_id in the script with your Google Form ID.
  • Modify the response processing logic as needed.

Future Scope

  • Extend this script to support other Google APIs, such as Google Sheets, Google Drive, or Google Calendar.
  • Use this repository as a trial environment to experiment with and test various Google APIs before integrating them into larger projects.

Happy Coding! 🚀

About

This repository contains a Python script that fetches responses from a Google Form using the Google Forms API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages