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 / Can't open Excel with ...
Power Automate
Answered

Can't open Excel with a dynamic file name

(0) ShareShare
ReportReport
Posted on by 14

I'm working on a flow to download a file from a website (CSV), open it in Excel, modify it, and then email it. I am having the hardest time trying to figure out how to Launch Excel and have it open the downloaded file. The file name is created by the website.

 

After downloading the file, I used the Get files in the folder to get the name of the file (I didn't attempt to use the DownloadedFile variable as sometimes it's a zip). I then added the Files variable to Launch Excel (see the second snippet). I get a file-related error.

 

If I try it and point to the file name itself, it opens fine in the flow. I also tried it on two different machines, one Windows 10 and one 11. I initially had the folder on OneDrive then moved to my local C drive to try. Ssaved as an xlsx thinking maybe the CSV format was the issue. Nothing seems to help.

 

Any help would be much appreciated as I've only just started to use PAD

 

 

 

trichmond_0-1668110990909.png

trichmond_1-1668111121036.png

 

trichmond_2-1668111658573.png

 

 

 

I have the same question (0)
  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    %Files% is a list, so you have to provide an index for the expression to return a singular file:

    %Files[0]%

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    For get files make sure you say sort by date last modified descending

     

    then the last downloaded file is %Files[0]% which is the first file of %Files%. You don’t need the folder in Launch Excel Document Path. A file type variable by default has the file path, file name, and extension all in one string.

     

    just put %Files[0]% in there and you will be good to go. 

    you may need a workaround if it is a zip files such as:

    if %Files[0].Extension% = zip

        Unzip folder to %UnzippedFolder%
        Get files from %UnzippedFolder%
    end (if)

    then do your launch excel with %Files[0]%

     

    Good luck!

  • trichmond Profile Picture
    14 on at

    Not sure how to delete a reply as I typed it up before seeing the other solutions.

     

    So I just cleared out. Thanks again 

  • trichmond Profile Picture
    14 on at

    The path being included was the issue. Thanks so much for the index and the path fixes!

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 252 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard