How to Get Sheet Name for WPS

Hello, I am attempting to obtain the name of a sheet without using the Excel Application Scope. Could you suggest an alternative approach for achieving this?

Sure. You can use “Get Sheets Name” activity from BalaReva.Excel.Activities package

BalaReva.Excel.Activities - Random and other categories / Community Feed - UiPath Community Forum

1 Like

Hi, It says its not compatible with Windows projects

Possible. Like many other custom activities in the Marketplace. I am still on Legacy also :slight_smile:

You could contact the publisher if he plans to release Windows compatible package.


Okay. Thank you so much

@Sai_Nandini_Tata ,
Give this a try:
SaiNandini.xaml (5.8 KB)

1 Like

you can try the code for accessing.

Dim excelFilePath As String = in_ExcelFilePath

’ Create an Excel Application object
Dim excelApp As New Application()

’ Open the Excel file
Dim excelWorkbook As Workbook = excelApp.Workbooks.Open(excelFilePath)

’ Get a list of sheet names
Dim sheetNames As List(Of String) = New List(Of String)
For Each sheet As Worksheet In excelWorkbook.Worksheets
** sheetNames.Add(sheet.Name)**

’ Close the Excel file

’ Release the Excel objects from memory
excelWorkbook = Nothing
excelApp = Nothing

’ Convert the sheet names to a DataTable and output it
Dim dtSheetNames As New System.Data.DataTable()
dtSheetNames.Columns.Add(“Sheet Name”, GetType(String))
For Each sheetName As String In sheetNames
** dtSheetNames.Rows.Add(sheetName)**
out_SheetNames = dtSheetNames

workflow is attached (143.0 KB)

The sheet name output will be in the format of data table.

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