How to get all Sheet names of excel using modern activities

Well u can get it with GET WORKBOOK SHEETS activity
Download example here

Or u can try this also


If that’s the case then u can try with coding options


Using vb net on invoke code activity

Dim excelApp As Microsoft.Office.Interop.Excel.Application
Dim excelBook As Microsoft.Office.Interop.Excel.Workbook

' Provide the path to your Excel file
Dim filePath As String = "YourFilePath.xlsx"

' Initialize Excel Application
excelApp = New Microsoft.Office.Interop.Excel.ApplicationClass()

' Open the Excel workbook
excelBook = excelApp.Workbooks.Open(filePath)

' Create a list to store sheet names
Dim sheetNames As New List(Of String)

' Loop through each worksheet and add its name to the list
For Each sheet As Microsoft.Office.Interop.Excel.Worksheet In excelBook.Sheets

' Close the workbook and Excel application

' Release COM objects to prevent memory leaks

' Now, the sheet names are stored in the sheetNames list
' You can use them as needed

Using python with “Run Python Script” activity

import pandas as pd

# Provide the path to your Excel file
file_path = "YourFilePath.xlsx"

# Read the Excel file into a Pandas DataFrame
xls = pd.ExcelFile(file_path)

# Get the sheet names
sheet_names = xls.sheet_names

# Output the sheet names

Hope this helps

Cheers @aslam_ali1

1 Like