uipath technical infomation for everyone

Get sheet name


Use the Copy Sheet activity to copy sheets.

Copy sheets

Suppose you have the following sheet in sample1.xlsx. Let’s look at an example of copying this sheet to sample2.xlsx.

1 Open Excel in the Excel Application Scope activity.
2 Place a Copy Sheet activity within the Excel Application Scope activity.

3 Set the properties of the Copy Sheet activity.

Properties Commentary
DestinationFilePath Specify the copy destination Excel file path.
DestinationSheetName Specify the copy destination sheet name.
SheetName Specify the sheet name to copy.

 

Sample2.xlsx after robot execution

 

3 Specify the variable prepared in “2.” for the wb property of the Excel Application Scope activity.

 

4 Place a For each activity.
5 Specify “String” for Type Argument, and specify “wb.GetSheets” for Values.

 

The sheet name is displayed in the Output panel in the Write line activity.

How to use the Get Workbook Sheets activity

Overall flow

The overall flow is not much changed when using the Get Workbook Sheets activity.
Open the Excel file in the Excel Application Scope activity. Get the sheet name in the Get Workbook Sheets activity. Get the sheet name using the For each activity.

Procedure

1 Open Excel in the Excel Application Scope activity.
2 Place a Get Workbook Sheets activity.

※ Get Workbook Sheets activity works only within Excel Application Scope activity.

3 Prepare a variable to store the acquired sheet name.

Select “Browse for Types …”

Enter “list” for “Type Name:”. Select “Systems.Collections.Generic List “.

Select “String” in the type selection.

4 Specify the variable prepared in “3.” in the Sheets property of the Get Workbook Sheets activity.

Place 5 For each activities.

Specify “String” for Type Argument, and specify “SheetsList” for Values.

The sheet name is displayed in the Output panel in the Write line activity.