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 / Implementing Office Sc...
Power Automate
Answered

Implementing Office Scripts on a Static SharePoint Path with a Dynamic Excel File in Power Automate

(0) ShareShare
ReportReport
Posted on by 12

Hello,

 

I am presently involved in a Power Automate project and I'd appreciate your help on a query I have.

 

How can I implement Office Scripts on a static path in SharePoint, while connecting to a dynamic Excel file using Power Automate?

 

Thank you in advance for your guidance.

Categories:
I have the same question (0)
  • josh115 Profile Picture
    12 on at

    PS., I tried the following solution, is there a better way to achieve the goal to improve the performance of the flow? Thank you.

     

    1. Create an Office Script that you want to run on the Excel files. Make sure the script is stored in your OneDrive.

    2. In Power Automate, create a new flow and add a trigger, such as "Manually trigger a flow" or any other trigger that suits your use case.

    3. Add a "Send an HTTP request to SharePoint" action. Configure the action with the following settings:

    - Site Address: The SharePoint site URL where your folder is located.

    - Method: GET

    - Uri:

    '_api/web/GetFolderByServerRelativeUrl('<your_folder_relative_path>')/Files?$filter=substringof('.xlsx', Name) or substringof('.xls', Name)'

    - Headers: Accept with value application/json;odata=verbose

    4. Add a "Parse JSON" action to parse the response from the previous action. Use the following schema:

    {

      "type": "object",

      "properties": {

        "d": {

          "type": "object",

          "properties": {

            "results": {

              "type": "array",

              "items": {

                "type": "object",

                "properties": {

                  "Name": {

                    "type": "string"

                  },

                  "ServerRelativeUrl": {

                    "type": "string"

                  }

                },

                "required": [

                  "Name",

                  "ServerRelativeUrl"

                ]

              }

            }

          },

          "required": [

            "results"

          ]

        }

      },

      "required": [

        "d"

      ]

    }

     

    5. Add an "Apply to each" action to loop through the Excel files. Use the "results" output from the "Parse JSON" action as the input for the "Apply to each" action.

    6. Inside the "Apply to each" loop, add a "Run script" action from the Excel Online (Business) connector. Use the "ServerRelativeUrl" dynamic content from the "Parse JSON" action as the input for the "Location" field, and specify the script you want to run.

  • Verified answer
    MichelleRanMSFT Profile Picture
    Microsoft Employee on at

    Hi @josh115, thanks for your question! If I'm understanding the example solution you shared correctly, you want to run a specific Office Script on every workbook in a specific folder? If so, you can create a flow using the following template: Run an Office Script on every Excel workbook in a SharePoint folder

     

    Does that work for you?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 822

#3
Haque Profile Picture

Haque 482

Last 30 days Overall leaderboard