Skip to content

bhagbhutni/Google-froms

Repository files navigation

Google Forms Auto-Filler Bot

This Python bot automatically fills out Google Forms by reading questions and providing answers based on a predefined mapping of questions to answers.

Features

  • Automatically detects and fills various question types:
    • Text fields
    • Radio buttons
    • Checkboxes
    • Dropdown menus
  • Supports multi-page forms
  • Uses fuzzy matching to match questions with answers
  • Provides logging for debugging
  • Supports headless operation

Requirements

  • Python 3.7+
  • Google Chrome browser
  • ChromeDriver (automatically downloaded via webdriver-manager)

Installation

  1. Clone this repository
  2. Install the required packages:
pip install -r requirements.txt

Usage

Command Line

python google_forms_bot.py <form_url> <answers_file> [--headless]
  • form_url: The URL of the Google Form to fill
  • answers_file: Path to a JSON file containing question-answer mappings
  • --headless: Optional flag to run the browser in headless mode

Example

python google_forms_bot.py "https://docs.google.com/forms/d/e/.../viewform" sample_answers.json --headless

Programmatic Usage

from google_forms_bot import GoogleFormsBot

# Create a bot instance
bot = GoogleFormsBot(headless=True)

# Define answers as a dictionary
answers = {
    "What is your name?": "John Doe",
    "What is your email?": "john@example.com"
}

# Fill a form
bot.fill_form("https://docs.google.com/forms/d/e/.../viewform", answers_dict=answers)

# Close the browser when done
bot.close()

Answer File Format

The answers file should be a JSON file with questions as keys and answers as values:

{
  "What is your name?": "John Doe",
  "What is your email address?": "johndoe@example.com",
  "How would you rate our service?": "Excellent",
  "Which features do you use most?": ["Email", "Calendar"],  // For checkboxes
  "Please select your preferred contact method": "Email",    // For radio buttons
  "Comments": "This is a great product!",
  "default": "Default answer"  // Used when no specific answer is found
}

How It Works

  1. The bot navigates to the specified Google Form URL
  2. It scans the page for questions using Selenium
  3. For each question, it matches the question text with the provided answers using fuzzy matching
  4. It fills the appropriate input field based on the question type
  5. For multi-page forms, it navigates to the next page
  6. Finally, it submits the form

Notes

  • The bot uses fuzzy matching to match questions with answers, so exact text matching is not required
  • Be respectful when using this tool and ensure you have permission to fill the forms
  • Google Forms may have anti-automation measures, so results may vary
  • This tool is for educational purposes and legitimate use only

Troubleshooting

  • If the bot fails to detect questions, make sure the form is publicly accessible
  • Some Google Forms may have additional security measures that prevent automation
  • Ensure Chrome and ChromeDriver are properly installed/accessible
  • Check the logs in google_forms_bot.log for debugging information

About

test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages