Duplicate Excel worksheet and Rename

is there a way to duplicate existing excel worksheet and rename it?

i try the code below. but it’s not getting buttons, dropdowns and images in my template worksheet.


template sheet:
template%20excel
duplicated sheet:
newSheet

DuplicateWorksheet.xlsx (31.0 KB)

Try this Python Script, just got it working on my end. This takes in the file path and sheet names. if you just want the one, you can remove the for loop
Credit: @cgartland for the base code nabbed from
https://forum.dynamobim.com/t/formating-excel-with-dynamo-is-it-possible/39692/3

import clr
clr.AddReferenceByName('Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
from Microsoft.Office.Interop import Excel

ex = Excel.ApplicationClass()   
ex.DisplayAlerts = False
ex.Visible = True
filepath = IN[0]
sheets = IN[1]

wb = ex.Workbooks.Open(filepath)

for s in sheets:
	wb.Worksheets("Template").Copy(After =wb.Worksheets("Template"))
	wb.ActiveSheet.Name = s
wb.Save()
3 Likes

@Mark_Rainville great work! I went ahead and added that to Bumblebee package:

Cheers!

1 Like