Project

General

Profile

Feature #3809

Update given Google sheet with the list of questions that have thumbs down greater than X

Added by Ram Kordale 23 days ago. Updated 16 days ago.

Status:
New
Priority:
High
Assignee:
Start date:
03/10/2025
Due date:
% Done:

0%

Estimated time:
0.40 h

Description

Google sheet to be used: https://docs.google.com/spreadsheets/d/1F5aDBK0GlwCZjxbegE0909rr3sgbsHD_LepQlgRCzEA/edit?gid=0#gid=0

Input would come from a file containing zero or more of:
server=dev|qa|prod
board=<board>
grade=<grade>
subject=<subject>
threshold=X

If the input file does not exist or is empty or does not have some key value pairs, assume all matching values. For example, if the input file does not exist, then the query would be all boards, grades and subjects. Also, if threshold is not available, assume X is 0.

Google sheet would contain zero or more entries with the following columns: board, grade, subject, style, chapter, exercise_number.

Sample code:

!pip install --upgrade gspread google-auth
import gspread
from google.colab import auth
from google.auth import default

  1. Authenticate and create the PyDrive client.
    auth.authenticate_user()
    creds, _ = default()
    gc = gspread.authorize(creds)
  1. Replace 'Your Spreadsheet Name' with the actual name of your Google Sheet
    spreadsheet = gc.open('Your Spreadsheet Name')
  1. Select the first sheet
    worksheet = spreadsheet.sheet1

rows = worksheet.get_all_values()

#do processing

  1. Example: Update a specific cell
    worksheet.update_acell('A1', 'Updated Value')
  1. Example: Append a new row
    new_row = ['Value1', 'Value2', 'Value3']
    worksheet.append_row(new_row)

Also available in: Atom PDF