I'm trying to delete an existing excel file so that I can upload the newest version. The file is in a shared folder and thus the struggle, I could not really find anything on the deleting of a file in a shared folder. Below is the piece of code that is producing an error.
def deleteExistingFile(team_drive_iddel, parent_folder_iddel):
file_name = 'To_Label.xlsx'
fileDel = drive.CreateFile({
'title': file_name,
'parents': [{
'kind': 'drive#fileLink',
'teamDriveId': team_drive_iddel,
'id': parent_folder_iddel
}]
})
fileDel.Trash()
team_drive_id = '0AHPtZymJwYgsUk9PVA'
parent_folder_id = '1KM6UIvmJ1nSZa62yFUxoQ-L4q6JZb4_W'
deleteExistingFile(team_drive_id,parent_folder_id)`
Any help would be appreciated.
The above is what I tried and it produced the error, I'm also not sure where the "file_id" might be needed.