Export file, Open it ..Copy it in UiPath

Hi Guys…

I have a case, I have to click on export link and the html file will be downloaded then I have to copy the html file and paste in excel file …

How can I do that in UiPath! actually I tried to click open downloaded file by web recording but I I am getting error …

its possible to do that in Uipath?

If your click and download works well for you then you are good,else there is another way to download the file to specific location(subjective) using http request by retrieving the url using get attribute.

Since it is HTML file, use open browser and give the local path (e.g. C:\downloads\xyz.html)

Hi @vvaidya , yes I could click and download file in particular path, but I need to open the file automatically,the file has different name every time its downloaded…
its is html file

Please in anyone can help,

This should give the latest downloaded file from your folder, you need to somehow make sure file is completely downloaded then call for the latest file. If this is not empty, use it in Open browser to open your file in a browser.

If you expect html and html extensions

string LatestFile = Directory.GetFiles("MY PATH","*.*").OrderByDescending(Function(d) New FileInfo(d).CreationTime).Where(Function(s) s.ToLower.EndsWith("html") OR s.ToLower.EndsWith("htm")).FirstOrDefault()

if only html

string LatestFile = Directory.GetFiles("MY PATH","*.html").OrderByDescending(Function(d) New FileInfo(d).CreationTime).FirstOrDefault()

1 Like

Just adding to @vvaidya’s solution, using the .SelectMany() rather than using the .Where, when it can be included in the filepattern

If you store your extensions to an array, then you can use .SelectMany()
extArray = {"html","htm"}

latestFile = extArray.SelectMany(Function(ext) Directory.GetFiles("MY PATH","*."+ext).OrderByDescending(Function(d) New FileInfo(d).CreationTime) ).FirstOrDefault()

So you can utilize an array in the pattern when you get the Files, which may be faster… I don’t know.

Regards.

1 Like

Thenks @ClaytonM and @vvaidya , I put the expression in assign activity instead of default value for a variable then can I use open browser activity to open file??

@ClaytonM I just need to open last file downloaded by creating date

Yeah, just put the file variable in Open Browser. If it doesn’t work, then try using Start Application with iexplorer for the app, and the file variable for argument.

1 Like

Thanks @ClaytonM @vvaidya its working fine !

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.