upload file to folder pydrive code example
Example 1: pydrive upload file to folder
file2 = drive.CreateFile({'parents': [{'id': '### folder ID ###'}]})
Example 2: pydrive upload file to folder
folderName = '###'
folders = drive.ListFile(
{'q': "title='" + folderName + "' and mimeType='application/vnd.google-apps.folder' and trashed=false"}).GetList()
for folder in folders:
if folder['title'] == folderName:
file2 = drive.CreateFile({'parents': [{'id': folder['id']}]})
file2.SetContentFile('new_test.csv')
file2.Upload()