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
Hi, It says its not compatible with Windows projects
Possible. Like many other custom activities in the Marketplace. I am still on Legacy also
You could contact the publisher if he plans to release Windows compatible package.
Cheers
Okay. Thank you so much
@Sai_Nandini_Tata ,
Give this a try:
SaiNandini.xaml (5.8 KB)
Hi,
you can try the Vb.net 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)**
Next
’ Close the Excel file
excelWorkbook.Close()
’ Release the Excel objects from memory
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelWorkbook)
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp)
excelWorkbook = Nothing
excelApp = Nothing
GC.Collect()
’ 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)**
Next
out_SheetNames = dtSheetNames
workflow is attached
Sheetnameextraction.zip (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.