How do i get Uipath to go to the Excel sheet name base on the files name?

Hi, for example the excel file names are:

  • APPLE-01.ver03.xlsx
  • ORANGE-01.ver04.xlsx
  • MANGO-01.ver05.xlsx
    And there is an excel worksheet that has the tab apple,orange and mango.

Then UiPath will be able to read from the files names and go to excel worksheets of the tabs respectively and update the files.

Hi @monicaong0609

You can use a RegEx pattern to extract the required data from the file names string like this:


In UiPath:

sheetName = System.Text.RegularExpressions.Regex.Match(currentfileName.ToString,” ^([^-]+)”).Value

Once you have the extracted data in the sheetName variable, use the same to name the sheet in the excel file.

Hope this helps,
Best Regards.

yes you can get the sheet name by filename.split("-"c)(0)

will give you sheet name if you want convert to lower then append .toLower


1 Like


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.