I am attempting to use a Flow in Power Automate Desktop to Open Microsoft Edge, navigate to a webpage, login, set parameters of a daily report and then download several unique .csv files. I need to then save the .csv files with a new name to a different location.
Really, I just need a way to open the file I just downloaded.
Is there a reliable way to make this happen? I can do this pretty easily by sending keystrokes of keyboard shortcuts, but would much rather use a less error prone option.
I've tried everything I can think of, including navigating to the "Downloads bar" and attempting to control the Options Menu as a UI element as well as a web element.
An alternative solution would be to launch an explorer.exe window to the downloads folder and get the file name with the most recent modified date, but Power Automate Desktop hasn't made that easy either.
Any thoughts or options would be appreciated.
Solved! Go to Solution.
I have done a same process as yours before by using Edge and I got the same requirements as yours also. Check out the two pictures I attached below.
So, first of all, you must change the settings from MS Edge so that will always ask you when downloading any files from the internet. It will ask you for where you want to save the file.
Then you need to add more steps on PAD for clicking on the Save as button, specify the location, and file name for you downloading files.
By using this way, you will know exactly where you stored your file with the name you set for it.
Thanks and hope it can help you.
Did I answer your question? Please consider to Mark my post as a solution! to guide others
I am still having issues with this flow. As for the "Get Files in Folder" option, I can sort by creation time. However, i need to be able to return the latest file and "Save As" with a new name in a different directory.
I tried the option of changing the download settings in Edge. I can not get PAD to recognize the "Save As" button as a UI element.
Robin.Core.ActionException: Click failed (failed to get UI element)
at Robin.Modules.UIAutomation.Actions.ClickElementInWindow.Execute(ActionContext context)
at Robin.Runtime.Engine.ActionRunner.RunAction(String action, Dictionary`2 inputArguments, Dictionary`2 outputArguments, IActionStatement statement)
It seems like this should be a fairly simple task. I'm sure i am just missing something.
I had a large number of similar files (1000s) in the destination folder. As a results, the "Get Files in Folder" function appeared to hang in PAD (I assume the sort function of all of the .csv files was taking a long time to return the most recently created file). Once I reduced the number of files in the destination folder, the process worked as expected. I marked the first answer as the solution.
I've got the same requirement. How did you get the Get Files in Folder to return just the most recent? I've got it sorting by creation time, but it returns the full list - not the single most recent? And then how do you save as?
%Files% retrieves the first file in the sorted list.
Save as is something you have to set up in the browser. By default, things are saved in the Downloads folder.
The challenges with this are we do not know where the file will be downlaoded to (yes we can hardcode for each computer but I prefer not to) and the filename may be different every time. I have done it in 2 different ways :
1. Send Control-J and click on Show in Folder. You can then rename the file or send <Enter> to open the file.
2. A more reliable method that I am using now is to configure the browser to open the Save As dialog box when downloading file. This way I can specify the folder and name of the file. Once saved I know exactly where the file is and I can take action on it.
This is the code I use which is very robust
GanCW, thank you for taking the time to respond. You are correct. Using the Send Keys function tends to be less reliable. As most of my PAD flows will be running in unattended mode, I am trying to stay away from Send Keys.
As for your second option, are you using Edge? With Edge, I can configure edge://settings/downloads -> "Ask me what to do with each download". However, this creates a UI element at the bottom of the current Edge window. Not a new window. When I attempt to left click the 'Save As' UI element, I get an error in PAD - "Click Failed (failed to get UI element)".
Am I missing something?
@sambone95 currently I've got my flow configured to go to a site, download a ZIP file, then unzip the file into a folder.
Running "get files in folder" when sorted by creation time returns the file path to the file I need, but I can't figure out how to launch the file in Excel. When trying to launch it, I get an error stating that the File Path has to be a Path, and "get files in folder" generates a list of files.
How did you get your PAD to open the file after finding it using "get files in folder"?
I have the download process in a loop. Each loop runs through an excel column, takes the next value in line, enters it into a search and downloads the report that pops up (1 file in a ZIP folder).
I then extract the file to another folder, and want to launch it in excel. The loop runs about 80 times resulting in 80 open spreadsheets. The problem is that it keeps opening the same file, the first one downloaded.
Is there any way that I can either rename the file that is unzipped so as to change the "modified" date, so that I can change the criteria within "get files in folder".
Alternatively, can I somehow get %Files% to replace 0 with the Loopindex?