Get sheet name and info without using Excel application scope

How can I get sheet name and data (specific row) in dynamic using the activities in workbook?
To be more specific, I have an excel file which contains 15 sheets, I would like to get all sheet names in that excel file.
Then, I would like to get the data in the specified sheet name.

Hi
welcome to uipath community
we can do that with INVOKE CODE activity where we can mention the vb.net code to get all the sheet name from a excel
https://docs.uipath.com/activities/docs/invoke-code

but using EXCEL APPLICATION SCOPE is very easy…may i know why you dont want to do with that

Cheers @pat_siv

2 Likes

Hi,

I suppose there is no activity which we can get sheet name in Workbook category
However, there is CloseXML library which is used by activities in Workbook category and you can get sheet name using it even if there is no Excel in your pc.

I’ll attach sample as the following.

Sample.xaml (6.3 KB)

Regards,

6 Likes

Hi ,
Here is an activity to get only sheets name

image

Regards
Balamurugan.S

4 Likes

Because my professor want me to be able to work with various platform not just only using excel application scope. So, he forces me not to use excel application scope. :cry:
Thank you so much for your help, I will try following your advice.

cheers @Palaniyappan

1 Like

thank you so much for you advice. i will try it

@Yoichi

1 Like

Excuse me sir, I have followed your advice but I got an new issue.
How can I solve this error? @Yoichi

Hi,

It’s difficult to get it from only this image.
Can you share your workflow, or content of both assign activity as text?

Regards,

Thank you once again for your help @Yoichi
Here is the activities I created,

  1. Assign Activity: filename = “Timesheet-201909.xlsx”
    Variable type: String

  2. Assign Activity: workbook = new ClosedXml.Excel.XLWorkbook(filename)
    Variable type: XLWorkbook

  3. Assign Activity: worksheets = workbook.Worksheets
    Variable type: IXLWorksheets

  4. For each activity: For each “item” in “worksheets” —> Message box: item.Name

Then, I save and run the file, and the output shown that
“Assign: Object reference not set to an instance of an object.”
Also shown the red square on the second assign activity as the above picture I attached.

Best regards.

1 Like

Hi,

Thank you for your reply.
It seems there is no suspicious sentence in your code.

As other possibility, there might be some reason in your workbook to be unable to read by ClosedXML.
Can you try blank excel workbook (just right click to create xlsx) instead of your workbook?

Regards,

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