pydrive upload file to folder

Solutions on MaxInterview for pydrive upload file to folder by the best coders in the world

showing results for - "pydrive upload file to folder"
Bogdan
09 Nov 2016
1file2 = drive.CreateFile({'parents': [{'id': '### folder ID ###'}]})
2
Fynn
24 Sep 2019
1folderName = '###'  # Please set the folder name.
2
3folders = drive.ListFile(
4    {'q': "title='" + folderName + "' and mimeType='application/vnd.google-apps.folder' and trashed=false"}).GetList()
5for folder in folders:
6    if folder['title'] == folderName:
7        file2 = drive.CreateFile({'parents': [{'id': folder['id']}]})
8        file2.SetContentFile('new_test.csv')
9        file2.Upload()
10