Skip to content
This repository has been archived by the owner on Nov 12, 2019. It is now read-only.

Commit

Permalink
Merge pull request #115 from russfeld/master
Browse files Browse the repository at this point in the history
Update Google Spreadsheets example
  • Loading branch information
brentru authored Jun 11, 2019
2 parents c9407aa + c7db406 commit afdb85b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/google_spreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
def login_open_sheet(oauth_key_file, spreadsheet):
"""Connect to Google Docs spreadsheet and return the first worksheet."""
try:
scope = ['https://spreadsheets.google.com/feeds']
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name(oauth_key_file, scope)
gc = gspread.authorize(credentials)
worksheet = gc.open(spreadsheet).sheet1
Expand Down Expand Up @@ -115,7 +115,7 @@ def login_open_sheet(oauth_key_file, spreadsheet):

# Append the data in the spreadsheet, including a timestamp
try:
worksheet.append_row((datetime.datetime.now(), temp, humidity))
worksheet.append_row((datetime.datetime.now().isoformat(), temp, humidity))
except:
# Error appending data, most likely because credentials are stale.
# Null out the worksheet so a login is performed at the top of the loop.
Expand Down

0 comments on commit afdb85b

Please sign in to comment.