-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadData.py
More file actions
74 lines (53 loc) · 2.26 KB
/
readData.py
File metadata and controls
74 lines (53 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import time
import pandas as pd
import gspread
from df2gspread import df2gspread as d2g
from oauth2client.service_account import ServiceAccountCredentials
# Read Google Spreadsheets
scope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
gc = gspread.authorize(credentials)
# For mentees
def read_rawMentees():
mentee_spreadsheet_id='14m89nbA7ST_fLA5S20piFXRUwvSO-YJqbBcViLzt8E4'
df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{mentee_spreadsheet_id}/gviz/tq?tqx=out:csv&sheet=Test_mentee")
print('Raw Mentees read')
print('20 sec cooldown')
time.sleep(20)
return df
def read_preMentees():
mentee_spreadsheet_id='14m89nbA7ST_fLA5S20piFXRUwvSO-YJqbBcViLzt8E4'
df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{mentee_spreadsheet_id}/gviz/tq?tqx=out:csv&sheet=Preselected_mentees")
print('Preselected Mentees read')
print('20 sec cooldown')
time.sleep(20)
return df
def read_rejMentees():
mentee_spreadsheet_id='14m89nbA7ST_fLA5S20piFXRUwvSO-YJqbBcViLzt8E4'
df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{mentee_spreadsheet_id}/gviz/tq?tqx=out:csv&sheet=Rejected_mentees")
print('Rejected Mentees read')
print('20 sec cooldown')
time.sleep(20)
return df
#For mentor
def read_rawMentors():
mentor_spreadsheet_id='14m89nbA7ST_fLA5S20piFXRUwvSO-YJqbBcViLzt8E4'
df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{mentor_spreadsheet_id}/gviz/tq?tqx=out:csv&sheet=Test_mentor")
print('Raw Mentors read')
print('20 sec cooldown')
time.sleep(20)
return df
def read_preMentors():
mentor_spreadsheet_id='14m89nbA7ST_fLA5S20piFXRUwvSO-YJqbBcViLzt8E4'
df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{mentor_spreadsheet_id}/gviz/tq?tqx=out:csv&sheet=Preselected_mentors")
print('Preselected Mentors read')
print('20 sec cooldown')
time.sleep(20)
return df
def read_rejMentors():
mentor_spreadsheet_id='14m89nbA7ST_fLA5S20piFXRUwvSO-YJqbBcViLzt8E4'
df = pd.read_csv(f"https://docs.google.com/spreadsheets/d/{mentor_spreadsheet_id}/gviz/tq?tqx=out:csv&sheet=Rejected_mentors")
print('Rejected Mentors read')
print('20 sec cooldown')
time.sleep(20)
return df