All about downloading files from the web using Power Automate for Desktop

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi there it's graciela from power gi on the side of the screen welcome to our channel some months ago we released a video talking about how to download files from the web using power automate for desktop however the tool has changed a lot during the last couple of months so this is an updated and extended version of that video we're gonna cover two different scenarios the first one is when your file is downloaded directly once you click on a link or a button for example if i go to this web page and i am interested in this monthly log and the category wide files once i click on them the download is automatically triggered so to go over that the only thing that you need to do is to use the recorder that part automate has that is now unified a couple months ago we had one recorder for web actions and one recorder for desktop actions and now we have only one so the only thing that you have to do when this is the scenario that you're covering is just go to the recorder and then a new window will show and then i'm gonna close my browser and then click on the on this three dots launch new browser and finally chrome what we're covering here focuses mainly on chrome however all the logic and all the setups that we're gonna see can be applied to chrome and firefox and any of the main browsers out there so let's just uh go to the website that we're gonna use as example and then i'm gonna expand this and start recording so as i was saying the only thing that you need to do is pretty much record the steps that you would normally do to get to your files in my case everything that i have to do is go to this web page and then just click on monthly long and then category wide and that's it once i have recorded or the actions that i need to get to my files i can click on finish if you have to do something else just make sure to click around and do whatever you need to do if you need to select a date you can do that and once you have all the steps that you need just click on finish in my case it's quite simple so i only have three steps i'm gonna close my browser and once i execute it you see it opens the web page and then i just get this pop-up that happens the first time you just need to click on allow and then the file will download and the next time that you execute it is gonna run normally so make sure to always allow for multiple files from the website and that's it you see that now i have these two files downloaded in my folders and it's in my computer now this will lead us to the next question that is where were your files be saved and how can you access them using power animate because most likely you will want them to be saved in a specific location or anything like that we're going to cover that after we go over the second scenario so the first one is complete now we're going to talk about the second scenario in which we have a pdf file and the browser opens the file in a document reader so we have to click on an additional button to download our files an example of this is this web page that we're looking at we have some pdfs here and if i click on it it opens the file so i can see it in the browser so it's no it's not downloaded to my computer directly i have to take a look at it first and then if i want to it will download the file if i use this button so this is happening because that's the setup that i have for my browser and that's actually the default setup for most of browsers but we can change it if we want this file to behave in a way that once we click on the link to a pdf file it downloads directly so we don't have to see this document reader we can set it up so for chrome the steps are go to the settings and then i'm just going to search here pdf and then site settings and then additional content settings and here i have the setup for pdf documents you can see that my default is open pdfs in chrome instead of download pdfs so if i click on download pdfs and then i close my browser and open it again if i click on the same link that we were looking at a couple of minutes ago you see that instead of opening in a document reader now it's downloading directly and i can do that as many times as needed so that's that's the first way to handle this scenario however if your process requires for some reason that the file needs to be opened and you really need to click on that on that download button then that's a different way that we're gonna see now i'm gonna go back and put my settings to open the documents i'm gonna click open close and in the meantime let's get started with a new power automate flow okay so the first part to get this done is doing the very same thing that we did for the previous scenario we just need to record the required steps to get tor files so i'm just gonna go to the recorder close my browser and start a new instance of the browser in this case i'm using chrome i'm gonna go to the web page that i need and then i'm gonna start recording remember that we need to do the very same thing that we were doing in the previous example we just need to record every single step that we need to get to our file in this case my link is very straightforward so it gets me directly where i want to go to download the file if you have to do something else like putting a date remember you can do it just make sure to record every single step and then once we get to our file we click on it and it opens so you can see that the first click that i did in the web page to get to this document reader was recorded we have it here click element on the web page but when i get to this screen as a single element you can see here that when i hover over this it's just the whole thing that it's being recognized as a single element so it's not recognizing this download icon this print if i click on it nothing happens in my recorder if i click on this download nothing happens here in the recorder steps so that's an issue because it's it's not allowing me to download so i will just for now go ahead and finish so i just recorded everything that i need to get to my file which in this case is super simple just go to a web page and then click on a link and then i will go to this ui automation because we have seen that this is not recognized as part of the web page by part animate it is recognized as as a different element in the ui so we cannot use any of the browser animation steps we need to use the ui automation so i'm going to go ui animation form filling and then i'm going to go press button in window this is gonna open a new uh window in which it will ask me what you which ui element i want to click for now we don't have any ui element we only have browser elements so i'm just going to go ahead and click on add ui element so i will go to my browser and you can see that it is still not being recognized that is because i have two monitors so when we are recording ui elements make sure that you have connected only one monitor because otherwise it's not gonna be recognized properly so i will go ahead and disconnect my second monitor and just stay in the first one for a moment so let's go again add ui element that's gonna take me to my browser and you can see that it now it's properly recognizing all the elements in the web page yep so in this case what i need to do is to select this download icon as the element that the bot needs to click on so to do that we need to click on the on the icon and then click on control and that's as you can see make it that will make automatically recognize the download button so i'm gonna go ahead and select and click save okay so now i'm just gonna add a weight step between clicking the link and trying to download the file so i'm going to click on wait drag it to the canvas and wait for five seconds i have my flow ready and i'm going to click on run okay so now as you can see the file is being attempted to be downloaded and this leads us to the next question which is where will your files be saved and the answer to this question is it depends on the setup of your browser because yours your browser can ask you every time where to download a file or it can have a default folder where all downloads will go so for chrome where we're gonna see that is if we go to settings and then i search for downloads and you can see here that i have a default location but i also have this enabled so whenever a file is downloaded i will be defining where it's gonna be saved so whenever i download anything it's gonna show this popup when when asking me where do i wanna save it and that's gonna happen for every single file the setup that you need for your process will definitely depend on your specific needs so now that we know that our browser will ask you every time to define where we want to save the file we know that we have to record the actions to save it with the pop-up that will show every time so whenever i click on a download icon or a download link it's going to show this window and i know that i want to save everything in this invoices folder so i'm just going to grab the path paste it into a notepad and then add a backslash and then just i'm going to add a file name test here and then dot pdf so if i use this and paste it into the file name there is where my files gonna be saved so let's go back to poweranimate click on the recorder and that it's going to automatically start recognizing everything that we have on the screen so i will go ahead and copy the path in the file test name and then put it here into the file name field automatically that recognizes whenever i populated it and then it recognized an additional click that i did but i don't need that one so i'm just gonna delete it and then just click on the save button so now my file is saved as you can see here it's in the downloads and then i'm gonna click on finish that's gonna make my steps come here into power animate i'm gonna move them here and remove some of the comments i don't need them for now and you need to keep in mind that part automate is super fast when it's doing these actions so it's gonna click on the download button and directly after that it's gonna try to populate the field for the file name and we know that it takes a couple of seconds for this window to pop up because it needs to download the file so what we're gonna do is we're gonna go to ui animation and then we're gonna select the wait for window action we're gonna put it right after we click on the download icon because we wanna wait for the window to show up so we can attempt to write the file name so i'm gonna click on window i'm gonna click on the window in the window that is for the file name i'm gonna wait for it to open and then i'm gonna click on focus window after it opens so let's click on save and now i don't want to always save my file name with this name that i have here what i want to do is i want to save it with the current date time so i will go to the daytime section then i'm going to drag and drop get current date time here and i'm just going to click save and i want to save this in a specific format so i'm going i'm going to convert that into text so we're going to go to the text actions and then convert date to text i go here and i'm going to select the result from the previous variable which is current date time and then here the first option is use a standard format but i want to use a custom one that i want to define it's going to be year months and day and then hours minutes and seconds so click on save and you can see that this is saved on formatted date time that's the name of the variable that or result is being saved so instead of that test name that i inserted when i was doing my recording i'm gonna remove that and i'm gonna add the formatted datetime text that we just generated and that's gonna make that the files are never having the same name so let's close the browser and try to execute the whole flow again yep so here is an error because it's recognizing double slash so i'm just gonna go ahead and edit my flow remove them and then it should be good okay let's hit save close the browser execute again okay here we are it downloaded properly if i open it then you can see that is a mapping to the to a file in my local computer so that covers the first question what how you can handle whenever your browser is going to ask you to define where you want to save every time now let's move to the second one which is it's always going to be saved in the default folder and we're gonna switch to the first flow that we built and just before running it i need to change the setup that we defined previously i'm gonna go to the settings and then downloads and i'm gonna disable this option ask where to save each file before downloading so i'm gonna disable it and i'm gonna close it and just be sure to note what is your download your default download folder in my case it's just a downloads folder that we had so i'm just gonna copy this path and paste it here as well in a notepad okay so we know that the files are going there and if i if i am here in the list of files and i order them by date always the latest file is going to show at the beginning so i've been downloading a lot of files in the last couple of minutes and the most recent one always shows at first whenever we are ordering by date modified or by date created so if we get the list of all the files in the default folder of downloads and then we just get the first one if we are ordering the sending by date we're always going to get the latest one so that's where that's the second approach that we can use whenever you have a default folder and you want to move that file from the default folder to another folder that you may have or where whatever you may need to to have your files whenever they are downloaded so i'm going to go ahead and open the folder actions and then get files in folder it's going to ask me which folder you want to get files from and i know that's my downloads folder if you have any other defined that's completely fine you can uh just select it from somewhere else it's just the one that i have for now and then i'm gonna open the advanced options and then we're gonna sort it by creation time and then we're gonna sort it descending because we want the latest one to be at the top so i'm gonna click on save and it's important to add a little bit of delay between when the files are downloaded and when the files are get from the folder because if the file is too big it's gonna click on the i it's gonna click on the link to download the files but whenever it gets to download it gets to getting the file from the folder the file will not be ready yet so it's not gonna work so you need to add a delay and know in advance how many seconds or minutes your file can take and based on that add a delay in this case i think that six seconds are enough because the files are not big at all and for the sake of this exercise we're gonna just download one file not the two of them so i'm gonna click on the file wait a couple of seconds for it to be for the file to be available and then only when i have waited that that amount of time i'm gonna get the files so the file is ready and we can get the first one and the next step is we get the file and we want to either move it or copy it somewhere else that will depend on your specific process on your specific needs so what we're going to do is we're going to move the file that we just grabbed from the previous step so we're going to go to the variables go to files and if i open the file section you see that i only have access to the account because files is a group of folders here we are getting sorry it's a group of files we're getting a group of files in a folder so it's not just one what we're going to do is we're going to trick power animate to always give us just the first one that i found and since we have ordering this in descending mode it will always give us the first file first so i will go ahead and um select the first element of the files found in the folder and then out of the first file i want to get the full name and that will contain the full path of the file that we should be placing here and now my destination folder is just gonna be in my documents and then invoices and then here you depending on your rules and your needs you're gonna have if the file exists or not you can overwrite it or do nothing so i'm gonna do save and similarly if you want to rename your files you can um just go ahead and rename it using the same logic if you want to add the time the the timestamp and and all of that so i will close my browser and last execute again but before that i like to have maximized windows so i will go ahead and do it and click on run okay the file is downloaded it seems like it had finished so if i go to my invoices and i click and i see the last copied file the last move file you see that is the one that we just got from the flow so these are the two ways in which you can handle where you want to save your files and for now we are using kind of a fixed path you know we always want to save them in the invoices file but let's suppose that you have one folder that has subfolders and depending on a value somewhere else in the screen you want to save it somewhere else you can always use variables and conditionals to define where you want to save it but then the main logic is there is that you either define it whenever you are saving the file and you use the recorder to interact with this pop-up screen or you use the default file so you use the default folder and you move the files around depending on where they should be and where they should come so that's it for now we hope that you found this video useful as you can see power animate has changed a lot compared to the previous video that we did previously and they had added a lot of new things and features but they still haven't fixed this browser animation um click download link action because that still can only be used with the automation browser which we know is not that great because it's based on explorer so you need to come up with different ways to download your files from the web and we hope that this guide is helpful for you and if that's the case please make sure to like and subscribe thank you so much and see you next time
Info
Channel: Power GI
Views: 30,866
Rating: undefined out of 5
Keywords: power automate, power automate desktop, files from web, web scrapping, rpa
Id: YryVXyFbBrE
Channel Id: undefined
Length: 21min 12sec (1272 seconds)
Published: Sat Jul 23 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.