-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate_status.py
More file actions
42 lines (32 loc) · 1.67 KB
/
update_status.py
File metadata and controls
42 lines (32 loc) · 1.67 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
import gspread
from oauth2client.service_account import ServiceAccountCredentials
def update_info_status(current_status,thd_id,msg_id,first,line_no): #updates the status of the product when tracking is done
scope= ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
credentials= ServiceAccountCredentials.from_json_keyfile_name('credentials_sheets.json', scope)
gc= gspread.authorize(credentials)
wks= gc.open('FitBit Tracker').sheet1 #change the google sheets database name
if first==str(1):
wks.update_acell('B1',current_status)
wks.update_acell('B2',thd_id)
wks.update_acell('B3',msg_id)
wks.update_acell('B4',0)
wks.update_acell('B5',line_no)
else:
wks.update_acell('B1',current_status)
wks.update_acell('B3',msg_id)
wks.update_acell('B5',line_no)
def update_error_status(thd_id,msg_id,first): #updates the status when error is encountered
scope= ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
credentials= ServiceAccountCredentials.from_json_keyfile_name('credentials_sheets.json', scope)
gc= gspread.authorize(credentials)
wks= gc.open('FitBit Tracker').sheet1 #change the google sheets database name
if first==str(1):
#wks.update_acell('B1',current_status)
wks.update_acell('B2',thd_id)
wks.update_acell('B3',msg_id)
wks.update_acell('B4',0)
#wks.update_acell('B5',line_no)
else:
#wks.update_acell('B1',current_status)
wks.update_acell('B3',msg_id)
#wks.update_acell('B5',line_no)