Skip to content

Instantly share code, notes, and snippets.

@bennokr
Created March 5, 2024 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennokr/3c412a0f7ef3b27396b5fb5f7e3ab62b to your computer and use it in GitHub Desktop.
Save bennokr/3c412a0f7ef3b27396b5fb5f7e3ab62b to your computer and use it in GitHub Desktop.
Scopus Review
{"installed":{"client_id":"258409864674-jcqkeivqrd8dcb2gv5egl76g384vflld.apps.googleusercontent.com","project_id":"scopus-review","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["http://localhost"]}}
import gspread
import textwrap
gc = gspread.oauth(
credentials_filename='credentials.json',
authorized_user_filename='authorized_user.json'
)
sh = gc.open_by_key('1My6bXzXi1eTL8aiUxLihLeU7fxxPpga6axJIUdXlLCU')
ws = sh.sheet1
print('Opened spreadsheet, size: ', ws.col_count, '*', ws.row_count)
n_rows = ws.row_count
print('Which user are you? Ameneh (1) or Benno (2)?')
colnr_user = int(input())
annotations = ws.col_values(colnr_user)
annotations += [''] * (n_rows - len(annotations))
while True:
rownr_first_empty = next(i+1 for i, v in enumerate(annotations) if not v)
title = ws.cell(rownr_first_empty, 6).value
abs = ws.cell(rownr_first_empty, 18).value
print('\n'.join(textwrap.wrap(title, 80)), '\n')
print('\n'.join(textwrap.wrap(abs, 80)), '\n')
print('Include (i) or exclude (e) ?')
inp = input()
new_annotation = (1 if (inp == 'i') else (-1 if (inp == 'e') else ''))
if new_annotation:
annotations[rownr_first_empty-1] = new_annotation
ws.update_cell(rownr_first_empty, colnr_user, new_annotation)
print('\n')
else:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment