Problems with downloading a file

I have to download an CSV File with an fix URL which gets an daily update and should be convert into an Excel Report.

But the problem begins with the “Download File” Activity already. I was a bit surprised that I have to open a browser, paste the URL with an “Type Into” activity in the browser and add a “Click activity” to initiate the download. My expectation was a bit more “direct” approach, which means the “Download File” Activity gets the following parameters from me: URL, Target Directory and a Filename.

Is there maybe another activity with an more “direct” approach, which I could use for downloading this file?

The next Problem is that the CSV File contains some german special characters in it, e.g. ä ö ü ß which are replaced with other special charcters. I tried it with different browsers, but the file is corrupted everytime. With Powershell and curl it works fine. Any other ideas how I can avoid this corruption?

Thanks!

Hi @Daniel_Fichtner

I am wondering what “Download File” activity you are talking about…could it be that you mean the “Wait for Download” activity?
https://docs.uipath.com/activities/docs/get-last-downloaded-file

If you want to use a direct approach you could e.g. use the package BalaReva.Externals.Activities. It comes with a direct “Download file” activity.

It could be that you need to pay attention to the encoding of the file. Do not use ASCII…UTF8 should work with these characters.

You could use this with target object as new System.Net.WebClient:

Hello Daniel,
In this video, download files via an HTTP request.

I attached the VB.NET code:

Blockquote
Dim httpRequest As HttpWebRequest = DirectCast(WebRequest.Create(“https://url.pdf”), HttpWebRequest)
httpRequest.Method = WebRequestMethods.Http.Get
Dim httpResponse As HttpWebResponse = DirectCast(httpRequest.GetResponse(), HttpWebResponse)
Dim httpResponseStream As Stream = httpResponse.GetResponseStream()
Dim doc As Byte()
Dim ms As MemoryStream = New MemoryStream()
httpResponseStream.CopyTo(ms)
doc = ms.ToArray()
File.WriteAllBytes(“C:\yourfile.pdf”, doc)

Thanks,
Cristian Negulescu