How to get the Sheet name from Excel

The WoorkbookApplication variable is an OutArgument and right now it is created when the activity is completed. This is why you have to use it outside the Excel Application Scope.

We will fix this in a future release.

2 Likes

Dear all:

I have a solution for y’all.

First, install this package.

ExcelActivities.1.0.18.nupkg (9.5 KB)

Second: open this xaml and set up the path to an excel workbook with more than one sheet.
Readsheetname.xaml (7.7 KB)

Please, please comment your findings on this.

Hello,
Can anyone please help me to know how to move the excel sheet to another workbook.

@Uma,
What about Read Range of the sheet to a datatable variable, then Write Range with that variable to the other file?

I’m sure there are a few other coding methods too.

Thanks.

No i want to move the sheet only which not having any data.and i am moving that sheet which is just template and i want to move this sheet into tge another workbook.
Thanks

Can you have the sheet in a file by itself? Then you can use the “Copy File” Activity to use the template with other datatables.

EDIT: Or, have a template with all the sheets you need, then like I said use Copy File and Write Range to the copied file to those sheets you want.

My template file only have the sheet(that having the format only)and i want to add this sheet into my anther workbook.supppse my one wb contains sheet 1and i wanto add this sheet 1into my another workbook.

I want to do same as option of excel move or copy .
Thanks

Can you copy the sheet to another Workbook and delete exisiting sheet?

image

My Excel sheet is protected and sent in eMail. I am downloaded and trying to read data when com exception is displayed. Is there alternate way to get sheet name

Hello,

can you please share me the document how you made the package procedure.

1 Like

It’s there… haha just right click and save as.

To get the Sheet Name follow the steps.

Step 1 : Insert activity Excel Application Scope and enter file path (with extension).

Step 2 : Create variable workbook with variable type UiPath.Excel.WorkbookApplication

Step 3 : Set properties Output : workbook

Step 4 : Create variable sheetName with variable type String

Step 5 : Insert activity Assign and assign workbook.GetSheets(0) to variable sheetName
sheetName = workbook.GetSheets(0)

Step 6 : Set properties To : sheetName and Value : workbook.GetSheets(0)

you will get the first sheet name in sheetName variable

4 Likes

this is the solution

1 Like

2 years passed, and this is still not solved…

Above solution is given for counting no of excel sheets.

How can we get name of sheets in an excel ?

Hi @Bharti_sanghmitra

You just have to get Output of Excel Application Scope as WorkbookApplication type and when you iterate on that array you will get sheet names See this -

SheetNames.xaml (7.8 KB)

Thanks,
Prankur

1 Like

Thank you it worked.
But i wanted to get sheets name without opening excel sheet.

Hi @Bharti_sanghmitra,

I have uploaded a new release in BalaReva.Excel.Activities only for your purpose that to get sheets name from excel without open.

Regards
Balamurugan.S

1 Like