How to Get names of Excel worksheets

Hello, I’m a beginner.
I have an Excel Workbook with many worksheets.
In my Excel Workbook, there are over 50 Worksheets.
I want to make PDF files from some worksheets(1 Worksheet to 1 PDF file) by robots.
Names of PDF files are from names of worksheets.

I think as follows:
(1) Use Excel Application Scope to my Excel Workbook
(2) Assign Output of (1) to variable1(UiPath.Excel.WorkbookApplecation)
(3) To get All Worksheets, use GetWorkSheets function, like “variable1.GetSheets”.

Then Error occurred “Exception from HRESULT: 0x80004002 (E_NOINTERFACE)”.
Message is “Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.Office.Interop.Excel.Worksheet’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208D8-0000-0000-C000-000000000046}’ failed due to the following error: Exception from HRESULT: 0x80004002 (E_NOINTERFACE)”.

Please teach me how to get names of Excel WorkSheets and convert worksheets to pdf files!

HI!
this might Help!

Also see if you have installed the required packages…i.e. Excel activities package.

Hi,

Check this link,

It may help you understand the scenario in a better manner

Thanks for your reply!
I have installed Excel activities package.
My sample robot well done for a workbook with one worksheet, but with a workbook with many worksheets Error occurred!

Do I need any packages?

Hey @Naoneko

Try these!

Get sheet names in this manner! :slight_smile:
SheetNames.xaml (7.8 KB)

Cheers.

2 Likes

Thanks for your reply and sample file.
But in your sample, I have changed file name to my excel file, same error occurred.

Thanks Everyone.
I am Naoneko.
I get an answer, but it is let me down.

Samples and my robot are correct.
But they do not work for my Excel workbook.
There is 1 Graph Sheet in my Excel workbook.
My robot works well for Table worksheets, but cannot work for a Graph worksheet.

Anyone has other answers?
If you have other answers, reply me!

1 Like

@Naoneko: Any solution found?