Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. from datetime import date, timedelta
  2.  
  3. from pydrive.auth import GoogleAuth
  4. from pydrive.drive import GoogleDrive
  5.  
  6. date_today = date.today()
  7. date_today_str = str(date_today.month) + '/' + str(date_today.day) + '/' + str(date_today.year)
  8.  
  9. def upload_file():
  10. gauth = GoogleAuth()
  11. gauth.LocalWebserverAuth()
  12. print("successful auth")
  13. drive = GoogleDrive(gauth)
  14. data = drive.CreateFile(metadata={"title": date_today_str + "_finances.csv"})
  15. print("file created")
  16. data.SetContentFile('./out.csv')
  17. print("file content set")
  18. data.Upload()
  19. print("file uploaded, goodbye")
  20.  
  21. data = drive.CreateFile(metadata={"title": date_today_str + "common_merchants.png"})
  22. print("file created")
  23. data.SetContentFile('./common_merchants.png')
  24. print("file content set")
  25. data.Upload()
  26. print("file uploaded, goodbye")
  27.  
  28. data = drive.CreateFile(metadata={"title": date_today_str + "per_day.png"})
  29. print("file created")
  30. data.SetContentFile('./out.csv')
  31. print("file content set")
  32. data.Upload()
  33. print("file uploaded, goodbye")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement