I am having difficulties adding and renaming an excel sheet in a workbook, I went through some previous post referring to use hot keys activity, but that is not my mission. I like to use codes to solve the purpose.
workbookapplication.setSheet(sheetname as string, createnew as boolean)
I tried to use this code but did not get the success. Could someone help me to understand setSheet and getSheet method and is there any other method I should use to add and rename sheet?
You can try Invoke VBA for executing the VBA code to rename the excel sheet.
Welcome to uipath community
— Fine to create a new sheet in excel a simple workaround is we can use use excel application scope activity and pass the file paste of the excel as input
— within this scope use a simple write cell or write range activity with the sheetname you want… with double quotes and it will create a new sheet in that excel
To rename a excel kindly have a view on this thread once that could help you resolve this
[ Excel renaming - #3 by ClaytonM]( Excel renaming - #3 by ClaytonM
Thank you so much for the tips, these are two simple ways I can understand, but only to change a sheet name is it justified to invoke VBA?
Can you please help me to understand two methods “setSheet” and “getSheet” and uses?
Please refer this
You can install the balareva.excel.activities
If you want to rename your excel sheet
Invoke VBA is actually easier than you think. When it is inside an Excel Scope, it interacts with the window, so it’s just a matter of using the VB for changing the sheet name.
I made a simple example:
where “July 2019” is the sheet you want to change and “New Name” is the new name which both in the parameters can be variables
and that is the script file created in Notepad using .vbs extension.
I also looked some of it on google to find the syntax for referencing a sheet name in vbscript code
Since those are actions, you can try using the Invoke Method but I’m not familiar with getting those working in UiPath.
To rename the sheet as linked by
@Palaniyappan, I normally use an alt-key combo, which performs the Rename Sheet feature from the ribbon menu.
So the keystroke combo is Alt, h, o, r, “New Name”, enter
If I see anything on using SetSheets, I’ll let you know.
To do the rename sheet can use this package …
I have successfully uploaded the BalaReva XL Activities in UiPath Go.
This package contains 36 custom activities. It is related to the Workbook, worksheet and sheet data. It helps and simplifies more processes into the excel file. All components can be configured very user friendly.
This package is having the below activities.
Pie Chart - Using these activities you can able to generate the Pie Chart
Column Chart - Using…
I have included a new activity that to rename the excel sheet’s name. “Rename Work Sheet.”
Sample File :
RenameExcelSheet.zip (38.8 KB)
Let me if you have any errors.
I would be happy to get more suggestions .