Dynamically name excel sheet

Hello ,

I am copying data from 3 different excel files into a single excel file into different sheets. How do i dynamically rename the sheets ?

Could someone help with this ?

1 Like

@diya_poovamma
Ok so you want to get sheetsname from 3 different files and want to create one excel corresponding data?

If you want to replsce from one to anther so follow these steps.
1- get sheetsname through get sheets activity
2- then use rename sheets activity

@raja.arslankhan not get sheet name. I want to create new sheets with different names.

@diya_poovamma

  1. One way is use Write range activity and give desirable sheet name. It will create automatically.

2- use for each loop and inside loop use create workbook and give sheetname variable in sheet block. Please mark checkbox-file is not present create new one.

Hello @diya_poovamma

You can use read range in the 3 different excel files and while writing to single excel, you need to use Write Range activity. In the Sheetname provide your required name.

It will create new sheets and it will write to the desired sheet.

You can watch the below video.But in the write range provide different sheetname and it will create the sheet dynamically.

Thanks

@Rahul_Unnikrishnan I have watched this video . I am implementing the same. But for some reason the i=i+1 is not working .

can you plz share the screenshot of the workflow which you have created?

But if i give desireable sheet name it will just have one sheet name . I need 3 different sheets for 3 different files i am copying

if you use i in the write range then it will create different sheet. Another approach is, you can read from different excel and get the sheetname . Then pass that name to the write range activity.

Thanks

And if i need to paste in desired sheet then i need to loop through all sheet names ?

ExcelMerge.zip (103.2 KB)

you can check the attached workflow.

Thanks

This is the error i get when i debug. But i have declared i as int.


Do you know what it means ?

I will check and get back. Thank you

go to variable panel and change the scope of i.

Thanks

I did change the scope. But its still not working .

I am doing the exact same steps you sent but it still doesn’t work .

just try executing the one which i sent. I executed in my machine and its working as expected. You need to put the input files in the Input folder and then execute.

Thanks

Actually i have executed the same and it works in my test process. But this error is coming in my main process though its the same steps executed.

And i have tried initializing it multiple times it still shows the same.

plz share your workflow. I can check it out.

Thanks

Hi @diya_poovamma

Check out the Updated XAML file

ExcelMerge_Update.zip (91.6 KB)

Regards
Gokul