Getting Excel files from different location and Refresh SAP query

I am quite new to Ui-path Automation. I made a sequence that opens the excel file and does some processing (login to SAP, Refresh query/save and close the excel).

I have 4 excel files with the same name stored in different folders (All file has different reports and SAP query). Do I need to create separate 4 sequences for all the excel files or is there any other smart way which gets the file from different locations and follows the same step?

Hi @Ravi_Thakkar welcome to forum

are u doing the workflow in uipath studio or studioX?

Thank you. In Studio

Hi @Ravi_Thakkar

U can try this way

  1. Put all these folders in one main folder let say main folder name is MAIN

  2. use a assign activity like as below

list_1 = Directory.GetDirectories(Main)

Main represent the main folder name , this list_1 retrive all the folder path which is inside the Main folder and store in string array.

  1. After this use for each activitiy with type argument as string to loop through each folder path inside the array list_1 (for each folder in list_1)

Inside the loop u can loop through each files in folder without need of creating 4 different sequence for it

Hope you got the logic

Let me know if u face any issues


Nived N :robot:

Happy Automation :slight_smile::slight_smile::slight_smile::slight_smile::slight_smile:

1 Like

Actually, I must not put all the folders together.
Is it possible like this:

I create a text/excel file that contains the path of all the files in the new line, and then loop through each line, get the path, and provide that path into the “Start process” activity. Once the flow is done, again it starts the procedure to get the path from the second line and so on until the end of the line.