Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Suggested answer

Running Office Script (JavaScript) on most recent file in a SharePoint folder via Power Automate

(1) ShareShare
ReportReport
Posted on by 2
Hello All,

I'm looking for some guidance on how to run an Office Script on the most recent file uploaded to a SharePoint folder through Power Automate. The general outline of operations is as follows:

- TRIGGER - when a file is created in a folder
- Find / get most recent added file (the one that triggers the flow)
- preform an Office Script (JavaScript) on that file
- then move the file elsewhere

Any suggestions or input is helpful. I do have the required licenses etc to run the office scripts. Ideally, this takes place in an automated cloud flow.
Thanks!
  • trice602 Profile Picture
    13,911 Super User 2025 Season 1 on at
    Running Office Script (JavaScript) on most recent file in a SharePoint folder via Power Automate
    If I can help with anything else please let me know or tag me in a future post, I enjoy reading and answering questions.  Always glad to help!  Tom 💯💯💯💯💯
  • trice602 Profile Picture
    13,911 Super User 2025 Season 1 on at
    Running Office Script (JavaScript) on most recent file in a SharePoint folder via Power Automate
    Hey there!
     
    I am following up on this post running office script (javascript) on most recent file in a sharepoint folder via power automate in this category building flows from 11/19/2024.  I know the post is a little older, but it is a common question here so wanted to take a moment and follow-up. I see there have been 1 replies and 1 likes and asking if your question has been answered.  If so, please help the community out by completing one or more of the following actions!  Thanks in advance!
     
    Easy as 1-2-3 ‼️💯⭐😎🆒🙏
     
    1) Mark a reply as a verified answer - this is essential, and it helps others with the same general question find this thread. ✅
    2) You can also mark one of more replies as a verified answer.  Please take a moment and give the author credit for volunteering their time. ✌️
    3) Like one or more replies.  Kudos always greatly appreciated! 👍
     
    Pro tip:  if you found your own solution or workaround, feel free to add a reply to your own post and mark it as the solution too!  The goal is to get this thread marked with a verified answer by anyone that finds one or more replies helpful!
     
    Again, thanks in advance for reading and responding, always glad to help!  Tom 💯💯💯💯💯
  • Suggested answer
    trice602 Profile Picture
    13,911 Super User 2025 Season 1 on at
    Running Office Script (JavaScript) on most recent file in a SharePoint folder via Power Automate
    Hi,
     
    Looks like you described this perfectly!  Start building!
     
    You don't need to locate or search for the file that triggers the flow, you just refer to it by the dynamic content from the trigger.  Office scripts is a standard connector.  Try this.
     
     
     
    ------------------------------------------------


    If this was helpful, please like and/or mark as a verified answer to help others find this too!


    Always glad to help! 💯💯💯💯💯

    Tom 

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

     


     
     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1