cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Google Drive Delete File Action References #gid instead of Filepath - ONLY WORKS ONCE!

I have a flow where I need to take a file from an email that I receive daily and save it to a specific folder in Google Drive with a specific filename, which will be the same every time. It needs to overwrite the old version, or delete the old version and save itself.

Would be nice if it could just update itself, and I know there is some version history thing going on with Google Drive for files sharing the same name, but I have used an azure fileshare to create a static link to download this file as long as it gets saved to the right folder with the same name every time. This was an easy workaround for Google Drive being really dumb about how it handles references to files, which brings me to my point.

It would seem that the Power Automate to Google Drive integration is creating a #gid reference to the file in the Delete File action such that the action only works once. It will not run a second time with a file of the exact same name in the exact same location but with a different #gid. The Power Automate UI leads one to believe that it's the filepath to the Google Drive file which is used to find that item in this delete action, but the dynamic content picker is actually only teasing you with the filepath that displays in the *File field. What is actually happening is it seems to be referencing the unique identifier for that file in Google Drive, called the #gid. Thus once deleted, that #gid can't be deleted again, so this action is useless as a parameterized command that should work whenever the filepath exists - it doesn't! For me it only works when the file with the same #gid that was used to select the filepath in the dynamic content picker (also tried manually typing it) still exists. If a different #gid exists in that filepath in Google Drive, the action will fail with "file not found" even though the user can easily verify that the filepath exists.

1 ACCEPTED SOLUTION

Accepted Solutions
Helper I
Helper I

Here's the flow logic that worked for me. I just need to periodically save this file and delete the existing version of it if there is one, or just save it if not.Here's the flow logic that worked for me. I just need to periodically save this file and delete the existing version of it if there is one, or just save it if not.Ok it's not actually the #gid but the FileLocator that we need.

I fixed this problem with some conditional logic that gets all the files in the folder and then deletes by FileLocator if the filename is a match. Then after that "for each" I save the email attachment with the desired filename in Drive.

View solution in original post

1 REPLY 1
Helper I
Helper I

Here's the flow logic that worked for me. I just need to periodically save this file and delete the existing version of it if there is one, or just save it if not.Here's the flow logic that worked for me. I just need to periodically save this file and delete the existing version of it if there is one, or just save it if not.Ok it's not actually the #gid but the FileLocator that we need.

I fixed this problem with some conditional logic that gets all the files in the folder and then deletes by FileLocator if the filename is a match. Then after that "for each" I save the email attachment with the desired filename in Drive.

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (9,169)