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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Check whether excel fi...
Power Automate
Suggested Answer

Check whether excel file is opened

(1) ShareShare
ReportReport
Posted on by 2
Hi, is it possible to check whether an excel file is already opened?

otherwise if my flow starts with launching excel and the file is already opened the flow crashes right away.
 
so basically I wanted to do a if not opened, then launch, if already opened, skip to next step kind of flow.
 
thanks in advance!
I have the same question (0)
  • Suggested answer
    eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at
    You can use "If process" to check if "EXCEL" process is running. Then you Terminate it or try to attach the excel if the name is already known to your flow.


    Or you could first try attaching the Excel and if it isn't able to do so then use Launch Excel.


    Attach to running Excel on error:
  • SARAVANA PRABHU R Profile Picture
    16 on at
    Yes, you can implement a check for whether an Excel file is open before launching it in Power Automate. Here's a general approach you could use:
     
    1. Use PowerShell or a Script in Power Automate:
       - You can add a PowerShell script to check if an Excel file is open. If the file is open, PowerShell will return a specific value, which you can use in a conditional step.
       - If the file is not open, the script will return a different value, triggering the launch step in your flow.
     
    2. Example PowerShell Script:
       - This script checks if a specific Excel file is open:

        $filePath = "C:\Path\To\Your\ExcelFile.xlsx"
         $excel = Get-Process | Where-Object { $_.ProcessName -eq "EXCEL" }
         if ($excel -and (Get-Process | Where-Object { $_.Path -eq $filePath })) {
             Write-Output "Open"
         } else {
             Write-Output "Closed"
         }

       - Save this script as a `.ps1` file and run it in your Power Automate flow. If it returns "Open," you can skip launching Excel.
     
    3. Set Up Power Automate Condition:
       - After running the PowerShell script, use the output to set up a condition in your flow:
         - If the output is "Open," skip the "Launch Excel" action and proceed to the next step.
         - If the output is "Closed," then launch Excel.
     
    This approach will help you avoid crashes by confirming the file's status before launching 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard