Assigning a value taken from one excel to a folder?

I have an excel file which has team names in it and I have to select one team and go to that particular team folder and read an excel file from that specific team folder and I have to do the same for other teams aswell. As I am a beginner in uipath please help me with this. Thanks in advance.

@sairama.deepthi

For Reading value from Excel, you can refer as below

After placing For Each row as suggested in video, you can place Read Range activity again and specify the path which you get from excel

Hope this helps you

Thanks

Thanks srini for the solution. I am able to get the folder name. But how do I pass the name I retrieved from excel file to readrange as folder path

I am using directory.getfiles(β€œE:\xx\abc"folder name retrieved from excel sheet,”.xlsx").
Is this correct?

@sairama.deepthi Assuming that All your Folder Names (Team Names) are in the Folder "E:\xx\abc", Most Probably the Below expression should help you in retrieving the excel file from that Folder.

listOfFiles = Directory.GetFiles("E:\xx\abc\"+ folderName ,"*.xlsx").ToArray

Where listOfFiles is a variable of the type Array of Strings, which means that it will hold the Collection of excel file paths present in the mentioned folder, and folderName is a variable of the Type String, also assuming that the folderName value will be the Value that is read from excel file which has Team names in it.

To Access the First Excel file from the Folder, You can directly get the file using the below expression :

teamsExcel = Directory.GetFiles("E:\xx\abc\"+ folderName ,"*.xlsx")(0)

Where teamsExcel is a String variable, and it will hold the full path of the Excel File present in the Teams folder name that was retrieved.

However There would be a case to handle the error that will occur when you do not have an Excel File in the Folder.

We can handle that particular error using an If Condition to check if the Files Exist at first, then retrieve the file path.

Let us know if you need more clarifications.

Thank you so much for detailed explanation. Will try and will update you if I am able to do it or not.

1 Like

@supermanPunch it’s working. Thank you.
@Srini84 thank you.

1 Like