Downloading zip file and pdf file from website

Someone please help me with this issue,In this scenerio my bot is basically downloading the PDF’s from nseindia website,to download pdf’s there is a CSV file an input file so bot reading that input file and whatever specific subject pdf’s i want to download it is downloading with the help of url for that iam using http request activity so with the help of url iam getting the pdf’s,Know some of the subject’s name of pdf’s is in zip format so user told me that bot should download that zip file also and it should uzip that file and take the pdf file from that unziped file…How can i do this?i have automated all for pdf’s sometime it will get zip file also how is this possible?

While downloding keep a if condition, if pdf output is null then there u build a flow for unzip file n so on… else u can continue with flow…

Hi @Priyesh_Shetty1,

You can use extract/unzip files activity in UiPath to extract the file and place it in you convenient location.

You need to modify the logic to download both zip and pdf file. And if it’s zip file> unzip > find relevant pdf file

@Gaurav_Malhotra most of the time there is only pdf’s file available to download but some time nse website upload the pdf in zip fomat so what is the logic i can use to download that zip?

@Gaurav_Malhotra i have used 2 loops one for each and another for each data row and whatever pdf files i want to download i have stored that in a array and used a if condition to download the pdf’s to download that pdf’s i have used http request activity…What logic i can use to download zip

From where you need to download zip file? Is it a link?

Command Text :- Expand and Archive
parameters:- Path ( place where you are storing the zip file)
destination path :- where you have to extract and keep the folder

let me know if this doesn’t solve your query

@Gaurav_Malhotra

Hi @Priyesh_Shetty1
In HTTP Request activity properties - Request URL Property you have to give URL

Store the URL in variable and give it in Request URL property

1 Like

@Priyesh_Shetty1, try to save the zip file same way as pdf and make a check that whether the downloaded file is pdf or zip.

If it’s zip , unzip it and take the required df file from the location

And if it’s pdf go as per original logic

@Gaurav_Malhotra i have used currentrow(“LINK”).tostring in url of http request

@Priyesh_Shetty1

your url will not change

the only thing you need to change is the file attribute

use like this If(currentRow("Link").ToString.Contains(".pdf"),"pdffilepath","zipfilepath")

cheers

@Anil_G but bot is downloading the pdf’s but in somecases there is zip file also to download how can i get that,Iam using http request activity to get pdf’s…so how can i get the zip also whenever i required

@Priyesh_Shetty1

Depending on url you can decide if it is zip or pdf right. The same condition is provided above,

Or do you mean one url has both zip and pdf ? I dont think so

cheers

@Anil_G

This is the input csv file

@Priyesh_Shetty1

If you see the link the extension is present in both

cheers

@Anil_G so how can i do bot is dowloading the pdf’s but when it found the zip it should download that how can i do?

@Priyesh_Shetty1

Use if condition as above…on then side its pdf and on else side it is zip

cheers