TOKEN_FILE = ".gsheets-pickle.base64"
# If modifying these scopes, delete the token file
-SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
+SCOPES = [
+ 'https://www.googleapis.com/auth/spreadsheets',
+ 'https://www.googleapis.com/auth/drive'
+]
def main():
"""Allows user to authenticate for the Sheets API.
new_sheet = turb.sheets.create(body=spreadsheet_body).execute()
+ # Now that we've created a new sheet, we need to also allow anyone
+ # with the link to the sheet to be able to edit it.
+ turb.permissions.create(fileId=new_sheet["spreadsheetId"],
+ body={'type': 'anyone', 'role': 'writer'},
+ fields='id').execute()
+
return {
'id': new_sheet["spreadsheetId"],
'url': new_sheet["spreadsheetUrl"]
credentials=gsheets_creds,
cache_discovery=False)
sheets = service.spreadsheets()
+service = build('drive',
+ 'v3',
+ credentials=gsheets_creds,
+ cache_discovery=False)
+permissions = service.permissions()
db = boto3.resource('dynamodb')
turb.slack_client = slack_client
turb.db = db
turb.sheets = sheets
+turb.permissions = permissions
def error(message):
"""Generate an error response for a Slack request