cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HEATFreight
Super User
Super User

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
HEATFreight
Super User
Super User

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
HEATFreight
Super User
Super User

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.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (1,713)