Rename excel sheet with dynamic name

Hi guys,
is possible to rename sheet without having the complete name?
Supposed to have first sheet named with a fixed part “Invoices” and after that the date. So the sheet name is Invoices 16/11/2021.
Is possible to rename the sheet with the current date even if i don’t know the exact sheet name? In particular, the date contained in the sheet name.
Many thanks

First what you’ll need to do is loop through the sheet names to get the index number. You can use the Get Workbook Sheets activity inside an excel application scope. Then loop through those until you find where sheet.startsWith(“Invoices”) and you have your full sheetName. You’ll have to run a macro to change the sheet name. I’ll post the workflow and macro shortly.

Here’s a sample workflow and macro included. I had to change the date format to use a dash instead of slash since slashes are not allowed in excel sheet names.

Sand4.xaml (9.9 KB)
ChangeSheetName.txt (135 Bytes)


Have a view on this Custom component from uipath marketplace where we can mention the new Sheetname

If you want mention today’s date with the sheetname

First let’s get the sheet name with the same custom component and save that in a string variable named strsheet

—now in rename sheet activity mention the new sheetname as
Strsheet.ToString.Trim+” “+DateTime.Now.ToString(“dd/MM/yyyy”)

This will rename with today’s date

Cheers @legiw18734

1 Like


First, “/” is one of invalid characters in excel sheet name. So now assume target date keyword is “16-11-2021”

If there is a sheet name contains date keyword “16-11-2021” as the following,


we can write workflow as the following using Rename Sheet activity. (11.1 KB)