web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get only visibl...
Power Automate
Unanswered

How to get only visible worksheets in excel using power automate desktop

(0) ShareShare
ReportReport
Posted on by

I'm trying to count all visible worksheet sheets in excel. Get all excel worksheet action is giving the all worksheets present in excel . but i dont want to view hidden work sheet.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    No native way to do it in Power Automate Desktop. You would need to use a script to do it, such as PowerShell or VBScript. 

     

    Here's a sample script that you can run in Run VBScript action:

    'Create a list for worksheet names
    Set WorksheetList = CreateObject("System.Collections.ArrayList")
    
    'Launch Excel
    Set Excel = CreateObject("Excel.Application")
    Set Workbook = objExcel.Workbooks.Open("%ExcelFile%")
    Excel.Application.Visible = True
    
    'Iterate through all sheets
    For i=1 To Workbook.Sheets.Count
     'If sheet is visible, add it to list
     If Workbook.Sheets(i).Visible = True Then
     WorksheetList.add Workbook.Sheets(i).Name
     End If
    Next
    
    'Return the list
    WScript.Echo WorksheetsList
    'Since PAD will still only return a single string instead of a proper list, you might want to join it with a delimiter you can control and then split it via PAD.
    'If that is the case, join it like this: 
    'WScript.Echo Join(WorksheetsList,",")
    
    'Close Excel
    Workbook.Close
    Excel.Quit

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard