How to add multiple excel sheet from other excel files and copy the data and match the name in other excel file?


I need some help there that involving in automation on excel in inserting an worksheet and copy the data over
I have added some example below

I would like to add 4 new sheet named A, B, C and D which is optional to my book1.xlsm

i have some excel file name with A , B, C and D(optional) so how can i copy over my excel file to my book1 with the name provided

For A, B, C, D excel file there have some number infront for their unique name while in between they have this unique letter of A, B, C and D will stay there forever
So based on my scenario am come with an automation to copy the data and insert the sheet name ?
Test (31.1 KB)


You can use copy Sheet activity and copy the sheet from one excel to another


as currently i have a condition where i cant just copy directly where the name of the other excel contain some keyword = to the sheet i going to paste in
Like say sheet A = 123_A_ABC2023.xlsx etc
Sheet B = 123_B_2023.xlsx

so i cant say i wan copy sheet A to 123_B_ABC2023.xlsx


So you need to find that file which contains A in it then use this


This will give the file name with A dimilarly you can use variable and get all


nice i see can i have an example / sample for UiPath ?

want to try it and what about say optional D as this D excel file sometime is there sometime is not how can i write this as well ?


This is how you would use

first you are checking if atleast one file is matching then get the filename into str_FileName

So for D if its not present then it would give zero files and would go to else side


so for this do i have to assign a variable first ? erm is it okay you can give me an sample for main.xaml for this so i can try it out tmmr ?

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