This script automatically fills out and submits comment forms on websites provided in a Google Sheet.
- Fetches website URLs from a Google Sheet.
- Opens each website in Chrome.
- Automatically detects and fills comment, name, email, and website fields.
- Submits the form.
- Updates the Google Sheet status for each website.
- Python 3.x
- Google Chrome Browser
- ChromeDriver (matching your Chrome version)
Install the required libraries by running:
pip install selenium gspread oauth2client
- Download ChromeDriver from: https://sites.google.com/a/chromium.org/chromedriver/downloads
- Extract and place
chromedriver.exe
somewhere easily accessible. - Add the ChromeDriver location to your System PATH or place it in the same folder as your script.
This script needs access to your Google Sheets via Google API credentials.
- Visit Google Cloud Console.
- Create a new project.
- Navigate to APIs & Services > Credentials.
- Click Create Credentials > Service Account.
- Save the generated JSON key file as
credentials.json
in the same directory as your script. - Share your Google Sheet with the service account's email address (something like
[email protected]
) with Editor permission.
- Update your Google Sheet URL:
Replace the
"Your Google Sheet Link"
in the script with the URL of your Google Sheet.
sheet = client.open_by_url("Your Google Sheet Link").sheet1
- Update Chrome Profile Path: Replace the path in the script with your own Windows username and Chrome profile:
profile_path = "C:\\Users\\Your User Name\\AppData\\Local\\Google\\Chrome\\User Data"
options.add_argument(f"user-data-dir={profile_path}")
options.add_argument("--profile-directory=Profile 1")
- Edit Your Personal Info:
Update the
name
,email
,website
, andmessage
fields in the script.
name = "Your Name"
email = "[email protected]"
website = "https://yourwebsite.com/"
message = "Your Comment Message Here"
- Make sure Chrome is closed (the script auto-closes it anyway).
- Run the script:
python your_script_name.py
The script will:
- Open each website in a new tab
- Fill and submit the comment form
- Close the tab and move to the next website
- Update the Google Sheet with "Comment Added" or "Error"
- This script is Windows-specific because it uses
os.system("taskkill /f /im chrome.exe")
to close Chrome. - Make sure your Google Sheet has a column with the word "website" in its header (e.g., "Website", "Website URL").
- If your comment forms have different structures, you might need to adjust the XPaths and field detection logic.
Use this script responsibly. Spamming websites without permission may violate terms of service and could lead to account bans or legal action.
This project is for educational purposes only.