-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
47 lines (32 loc) · 1012 Bytes
/
Copy pathdatabase.py
File metadata and controls
47 lines (32 loc) · 1012 Bytes
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
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import pprint
import sys
import time
print(sys.argv[1])
print(sys.argv[2])
print(sys.argv[3])
scope=['https://spreadsheets.google.com/feeds']
creds=ServiceAccountCredentials.from_json_keyfile_name('client_secret.json',scope)
client=gspread.authorize(creds)
sheet = client.open('database').sheet1
pp = pprint.PrettyPrinter()
# data = sheet.get_all_records()
data = sheet.cell(1,1).value
data = sheet.col_values(1)
pp.pprint(data)
var = raw_input("Enter an entry to database ")
#var= "testing this function"
testVar= []
testVar= var.split()
print "Current date " + time.strftime("%x")
## Only time representation
print "Current time " + time.strftime("%X")
print (testVar[0]+","+testVar[1])
#row=["Michigan","Is","Awesome"]
#x = raw_input('Input row data')
#print x[1]
row = [sys.argv[1],sys.argv[2],sys.argv[3],time.strftime("%x"),time.strftime("%X")]
sheet.insert_row(row,2)
row = sheet.col_values(1)
print(row)