Login to website, download file and send through Email using Power Automate

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] GI on this side of the screen in today's video we're gonna be learning how to use power automate for desktop to log into our website and download files from it we're gonna be using as example this website in which users have to log in then go to specific screen here we're gonna see a list of invoices that we want to get I'm gonna search by the invoice I'm gonna find it and then I'm gonna click on this more icon and then on the print button this is going to open a new tab and here's where I can download the file so it can be in my specific in the specific folder that I want it to be now it's really important to mention that the fact that the PDF is open in a new tab it's because that's the way Chrome it's set up for this specific process I really don't need for the file to open first so I can download it so what we're gonna do I'm gonna go to these three dots and then settings and I'm gonna search for PDF then we're gonna go to site settings additional content settings and then PDF documents I'm gonna say I'm gonna change this setup from open PDFs in Chrome to download PDFs and after that my files instead of opening into a new tab they are just gonna download directly as you can see here I'm gonna close this if I click again on the print button automatically it goes to my downloads folder that I have defined as a default download folder now let's um get into it I'm gonna go to Power anime and I'm gonna start a new flow I'm gonna call it log it and download I'm gonna close this browser for now and the first thing I'm gonna do is go straight to the recorder and that's gonna open this small window here where I'm just gonna click on the three dots and then I'm gonna launch a new browser I'm gonna hit on Chrome this is based on Chrome but all the logic that we're gonna do also works for any of the other major browsers so the first scene I'm gonna go to the login page of the website and then I'm gonna start recording you can see how it automatically recognizes what what's the link that it needs to go to then I'm gonna just start typing in my credentials and then the password and then hit on the login you can see that with the record there for automate is pretty much just taking everything that we have done and putting it into specific actions the recorder is super helpful and that should always be your first thing to do whenever you are trying to do a process like this just start recording whatever your regular process is so my next process is going to the menu and then sales and then sales again you can see that all the clicks that I just did on the web page are being recorded as well then I go to the search button and then I'm gonna look for that specific invoice number so that's gonna be invoice number three that's gonna populate here and then I'm gonna click on the search icon then we're gonna just click on the zoom and finally just click on download that's it let's finish and you can see how automatically part automate has started adding all the steps into the canvas here is logging in and then it goes to the specific page that we needed to go to then it searched for the invoice number and then it downloads I'm gonna log out and try to start the process again to see if there's any step with errors yep you see that my invoice is now being downloaded properly so I will go back to part automate and just realize that there's an additional click here in the middle I don't need it so now it should be good then if I go to my default folders which is a downloads folder you can see that all the invoices that I've been downloading today and this is not where my invoices need to be because I want them to be moved to this invoices folder so what I'm gonna do is just um add some additional steps so I can move my invoices from the downloads which is my default folder for Chrome and move them to the Final Destination that I need them to be I need them to be with the invoice number that um that we are downloading the number from the system so what I'm gonna do I'm gonna add here a new input variable so this will Define the invoice number that we want to download So for this scenario I'm gonna just change from number three to number two and then I'm gonna change this to invoice number so this is the invoice number that we want to download that we want to get there from the system and here you can see that it's hard coded we have the F3 so I'm just gonna change this variable uh to this input that we are doing in the website to the invoice number variable that we just created that way we can Define what's the input that we want to download here's uh it's going to be the invoice that it's going to be getting from the system and then this is the very same name that we're going to be using to save the file with so again we are trying to get the file out of the default folder to the actual folder that we want to move them so you can see that I have here ordered my files by date modified and if I ordered them from most recent to oldest one the first file is always going to be the file that I just downloaded so this is a similar this is the logic that we're gonna try to follow for this example I'm just gonna go to folder and then use this action get files info in folder so I'm just gonna drop it to the canvas and I want to get the files in the downloads folder in this case I'm gonna apply just a filter because I always want to see just the PDF if you're if you're downloading csbs or Excel files you can also apply the same filter and I'm gonna go to the advanced options and I'm gonna sort it by the creation time and then I'm gonna sort it descending because I want a most recent ones created first so I can grab always the first file and this is gonna this is gonna make our life easier so I will just go ahead and say this is gonna get a list of files in this downloads folder and then what I'm gonna do is just move this file to the Final Destination so then I'm gonna go to the file and I'm gonna go to move files I'm gonna drop this into the canvas and the file that I want to move you can see for example if I open my downloads if I open here my downloads and select a file I need to indicate what's the full path of the file that I want to move and whenever we are getting a list of folders a list of files from a folder in power automate we can access to the full path so what I'm gonna do is I'm gonna open the list of variables you can see that now that I have added step number 14 which is get files in folder I have this files variable that I can access to so if I click on it that's gonna directly go to the field and here is a list and we want to get just the first one because we want to trick our anime to always get the first one so we make sure that the most recent one is always at the top so I'm just gonna in the files list I'm gonna grab the item or the index 0 that's going to be the first file and out of that I'm gonna get the full name because the full name is the attribute that contains the Full path that looks in the very same format that we took a look when we selected the file manually now I'm gonna move this to my invoices folder which is under documents and then invoices and then here it's gonna ask me what it should do if it file exists I'm gonna click on overgride for now and then I'm gonna click on Save and finally I'm gonna add a rename step because I don't want it to be mpdf 6 I want it to be the the actual invoice number that we are defining as a variable so the file that we are gonna rename is the one that we were moving from the previous step I'm gonna also access the first one because mold files is also a list so we're gonna go with full name and then we're gonna set a completely full name or we can just add text there are different options for this specific case what we want to do is we want to map it to the invoice number that we defined here so I'm just gonna add invoice and then a blank space and then the variable that we just defined which is in this case f slash two and if the file exists I want to overgride and then I'm gonna hit save finally the only thing that we need to do is we need to see or try to estimate at a time that it takes for the file to download because whenever we click on the download icon in the website right after that it's gonna try to get the files from the folder if the download is still processing whenever we get to step number 14 then this is not gonna work properly so we need to add a little bit of weight between those steps to make sure that we always grab the most recent file otherwise there may be errors in my case we're just downloading a small PDF so five seconds is definitely more than enough to process this so I will just log out then restart again okay so there seems to be a little issue here with the with one of the missing links and that is because I removed one of the steps the that should have been here this is number 10 is the one that I should have deleted and I deleted by mistake the one that was saying anchor so what I'm gonna do is I'm just gonna duplicate this step by copying and pasting and now this is here and I'm just gonna change the UI element from anchor to Anchor 2. to the regular anchor then I'm gonna just restart it yeah there we go okay so now let's take a look at our invoices and you can see here that now it's downloading the invoice F2 and then if I go here and I change it to number one it's gonna do the very same thing it's important as well to keep in mind that you can find different ways to improve your code once you record the steps so in this case you see that I followed the regular path that a user would follow to get to my invoices list but you can see that we have a specific link for the sales and for the invoice table so what I can do is to scrap this URL and then remove this when I click on the menu and then I go to sales what I can do is remove these steps and replace that step by using the go to web page so I'm gonna go to this URL and then let's test it again now it logs in and automatically it goes to the next to the to the URL that I defined and we have saved a couple of steps in by doing that a small change if I go again I'm gonna see invoice F1 here properly downloaded and now just as an extra step I'm gonna go ahead and send this invoice through email so I will just go to the Outlook section and then I'm going to start a new outlook session that I'm going to save and then I'm gonna use this action that is called send email message through Outlook so I'm gonna drop it to the canvas and in the account I'm gonna write my email and then I'm gonna send this to myself for now and then I'm gonna set the E the subject to be invoice and then the invoice number variable that we defined at the beginning I'm gonna add this is the body and then finally this is where we would set up the attachment and if I try to select the attachment from from here pretty much what we have to do is just indicate the path of the attachment that we want to send so you know that whenever we are working with files in part automate you can retrieve the full name so what I'm gonna do is just go to this select variable and then I'm gonna select on renamed files the rename files I'm gonna just select the first one in this case we are renaming just one of the files but you can see that it is still return a list of files so we need to add this part to indicate that we want to move the first element and then that full name now I'm gonna hit save and finally I'm gonna run this process now if I open Outlook you're gonna see that I have here in my sent items the new invoice this is ready we have logged in into the website downloaded the file and then moved it to the Final Destination and then send it through email there are different variations of this process in which there's a specific link that you want to download when there's some times that you get a pop-up on where you want to save the file if you want to know more information about all those scenarios make sure to take a look at the video that we have posted in the description of this one because more of those details are discussed there we hope that this video was useful thank you so much and see you next time [Music]
Info
Channel: Power GI
Views: 18,259
Rating: undefined out of 5
Keywords:
Id: GG0I0glnMmQ
Channel Id: undefined
Length: 14min 32sec (872 seconds)
Published: Mon Aug 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.