pydrive upload to specific folder not own code example

Example 1: pydrive upload file to folder

folderName = '###'  # Please set the folder name.

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()

Example 2: pydrive upload file to folder

file2 = drive.CreateFile({'parents': [{'id': '### folder ID ###'}]})