Hello Everyone,
I hope you're all doing well! I'm currently working on a project in Excel and I'm facing a challenge. I want to duplicate/copy an entire Excel sheet, including all its data, into a new sheet within the same workbook using power automate desktop. I want to create multiple copies of the sheet for analysis purposes.
I've tried a few things, but I'm not getting the desired results. Could someone please provide me any other method to accomplish this task efficiently?
Your assistance would be greatly appreciated! Thank you in advance.
Best regards,
Suraj
Sorry for late response.
Thank you it work. Thank you so much.
What exactly doesn't work? What happens when you try it? Can you share some screenshots of what you did and the results?
Hello @Agnius
I tried but it does not work for me.
Have you tried the VBScript that @WillSG suggested. It does exactly what you want to do. You just need to pass in some parameters into the script based on your actual file, such as the file name and the sheet name.
Hello. @WillSG I hope you are doing well.
Thank you for your kind assist.
let me explain what i am trying to do. My english is not that much good. Please bear with my english.
I have 2 excel file one is filled with required data and another one is following format excel file.
where i write the data of first excel file.
After fill the all required filled in above excel, i want to create a copy of that sheet with the name of company name as new sheet name. I want to repeat this task multiple time.
i tried all the possible way, it copy only excel data that is filled in the above excel file. i want to copy all data including format also which is i am unable to do.
Your assistance would be greatly appreciated! Thank you in advance.
Best regards,
Suraj
Hi @Suraj_Adhikari I hope you are doing well.
You can use the Action “Run VBScript” and run a Visual Basic Script as shown here below:
' Create an instance of Excel application
Set objExcel = GetObject(, "Excel.Application")
' Get the workbook named "Book1.xlsx"
Set objWorkbook = objExcel.Workbooks("Book1.xlsx")
' Get the worksheet named "Sheet1"
Set objWorksheet = objWorkbook.Worksheets("Sheet1")
' Create N copies of the worksheet
For i = 1 To %UserInput%
objWorksheet.Copy , objWorksheet
Next
' Clean up the objects
Set objWorksheet = Nothing
Set objWorkbook = Nothing
Set objExcel = Nothing
The variable name %UserInput% is created in action #2. The Input Dialog Action can be use in this way to define how many copies do you need, see image below.
In this example I’m testing with an Excel File named Book1 and a tab named Sheet1, if the file name and tab name will change, you can adjust accordingly and use Variables instead.
Hope this helps,
If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.
Additionally, if you have any questions, feel free to DM me, and we can initiate a discussion.
Kind regards,
Will SG
Managing Director & Automation Lead
RAMS CR (Recruitment & Automation)
@SeanLin Thank you i will try
Although there is no direct way to do that, you can calculate the first free row and column then copy the data from the source worksheet to the new worksheet you want.