Skip to content
/ Q4T Public template

Post scheduled quizzes on Telegram using a list of questions from Google Sheets


Notifications You must be signed in to change notification settings


Folders and files

Last commit message
Last commit date

Latest commit



44 Commits

Repository files navigation

📝 Scheduled Quizzes for Telegram

Post scheduled quizzes on Telegram using a list of questions from Google Sheets

🔌 Set up

  1. Click the Use this template button on GitHub and create a private repository
  2. Create a Telegram bot
    • Follow these instructions to generate a token
    • Add your token to
    • Add the bot to your channel or group and promote it to administrator
  3. Connect to Google Sheets
    • Go to Google Developer Console and create a new project
    • Click + ENABLE APIS AND SERVICES and enable the "Drive API" as well as the "Sheets API"
    • Navigate to "APIs and Services" > "Credentials"
    • Click + CREATE CREDENTIALS and select "Service account"
    • Fill in the required fields, press CREATE, CONTINUE, and on the last step click + CREATE KEY to download a JSON file
    • Upload the JSON file at the root of your GitHub repo and add the filename to the credentials variable in
    • Copy the Google sheet template and share it with the email address found in client_email in the JSON file
  4. Configure options in
Option Description Type Example
spreadsheet Required - The name of your Google sheet String Q4T Template
channel Required - The unique identifier of your chat or the username of your channel (the part after in the invite URL) String q4t_playground
loop Whether of not the bot should loop through the questions if all the questions have been exhausted Boolean True
anonymous Whether to keep the responses anonymous (Note: this must be set to True for channels) Boolean True

⚠️ Make sure your repository is private, because your Google credentials and Telegram token is sensitive information.

🖥️ Usage

You can add as many question/answer sets in your Google sheet as you want. You can also send an image alongside each question by providing the link to the image. The image will be sent immediately before the question. Everytime the script is run, it will send a quiz to the target chat or channel and increment the index in the index sheet. You can keep adding more question/answer sets indefinitely.

Run at scheduled interval

To send quizzes at a certain interval, run src/ at the specific interval. The recommended way to do this is to use GitHub Actions. Here is a sample workflow you can put in .github/workflows/main.yml to send a quiz every day:

name: Send quiz
  - cron: '0 0 * * *'

    runs-on: ubuntu-latest
    - uses: actions/checkout@v1
    - uses: actions/setup-python@v1
        python-version: '>=3.6'
    - name: Install dependencies
      run: pip install -r requirements.txt

    - name: Send quiz
      run: python src/


To reset the spreadsheet, simply run This will remove all questions and set the index to 2.


Post scheduled quizzes on Telegram using a list of questions from Google Sheets







No releases published