question

ffbld01ukibmcom-1577 avatar image
0 Votes"
ffbld01ukibmcom-1577 asked YutaoHuang-MSFT commented

Is there any API available to run excel script via API?

We see that Microsoft power automate allows users to select and run the automation scripts on the user's excel files. I tried to find any API which allows us to do the same job using an API such as excel Rest API or MS Graph REST API but so far we did not find any such API. I'm not unable to comprehend how is ms power automate achieving it internally if there is no such APIs available?

  • Request the team here to please point us to any option which can allow the user to run the excel automation script preferably via MS Graph API.

  • If Graph API does not have any such option, I will request you to please let us know if there is any other API that has such options.

office-scripts-excel-devmicrosoft-graph-data-connect
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MohammedMehtabSiddiqueMINDTREELIMI-9821 avatar image
0 Votes"
MohammedMehtabSiddiqueMINDTREELIMI-9821 answered

Hi @ffbld01ukibmcom-1577, Thanks for reaching out.
The feature to run automation script for excel files using MS Graph REST API is not available at the moment, if you want to raise a feature request for it Feature request.



If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ffbld01ukibmcom-1577 avatar image
0 Votes"
ffbld01ukibmcom-1577 answered YutaoHuang-MSFT commented

Thanks for the quick response. I was curious to know if not the MS-Graph API, is there any other API that allows running a script over excel files?

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @ffbld01ukibmcom-1577,

As @MohammedMehtabSiddiqueMINDTREELIMI-9821 pointed out, we don't yet have an API to directly execute Office Scripts at this moment. But I'd love to hear a bit more about your scenario here. Are you thinking to integrate the Office Script executing capability directly into your app/service?

For a short-term workaround, I am wondering if you would consider creating a Power Automate flow with:


  • An HTTP request trigger that can expose a HTTP URL that accepts incoming web request (with optional parameters)

  • A Run script action that will execute your actual Office Script

  • A Response action that can return the script execution result back to the caller.


So you probably can treat this flow as a Web API that you can invoke via the HTTP URL of the trigger to indirectly execute the Office Script.

1 Vote 1 ·

Actually, we are developing a connector kind of app that allows users to execute any already available script in the user's excel file. We have seen similar capabilities in other apps like ms power automate Flow. We were wondering if such APIs are not available, how is MS power automating implementing it?

0 Votes 0 ·
YutaoHuang-MSFT avatar image YutaoHuang-MSFT ffbld01ukibmcom-1577 ·

Thanks for the explanation! I would love to understand a bit more about your scenarios here and see if there is anything available on our side right now that might be helpful for you.

  • Just to make sure we're on the same page - here you are thinking about running Office Scripts for Excel on the web (https://docs.microsoft.com/en-us/office/dev/scripts/overview/excel), not the traditional VBA (or macros), right?

  • Could you elaborate on "execute any already available script in the user's excel file"? The Office Scripts created by a user are stored on their OneDrive for Business. The scripts are not embedded in any Excel workbook. And if a user wants to see and run all their previously created scripts, they can do so in Excel on the web by clicking on the Automate/All Scripts button on the ribbon.

  • For more details about Office Scripts: https://docs.microsoft.com/en-us/office/dev/scripts/overview/excel.

Please feel free to reach out to us if you have any further questions!

0 Votes 0 ·
ffbld01ukibmcom-1577 avatar image
0 Votes"
ffbld01ukibmcom-1577 answered YutaoHuang-MSFT commented
  • Yes you are correct, I'm NOT talking about traditional VB script

  • I'm talking about Office Scripts for Excel on the web

  • I want to allow users to see the available scripts on their Business one drive account before they select which one to run on any workbook (Just like MS power automate)

  • I want to allow users to run the selected script against any selected workbook (Just like Ms power automate allowed users to do)

  • We were wondering how is ms power automate achieving this thing? They must also be using some API to allow user to execute script on excel file


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@YutaoHuang-MSFT request your attention

0 Votes 0 ·
YutaoHuang-MSFT avatar image YutaoHuang-MSFT ffbld01ukibmcom-1577 ·

Thanks for the clarification!

I'm wondering what the gaps you are seeing in the current Office Scripts experiences inside Excel on the web. From there a user can see all their scripts stored on their OneDrive for Business and they can select any of them to run on any workbook they have access to. It seems to be able to fulfil most of the scenarios you described. But maybe you're thinking to build a custom solution with your own UI then the Office Scripts UI obviously won't help.

At this moment, we don't yet provide a "Run script" API that users can directly consume. As a workaround, you can probably use Microsoft Graph API to discover the script files stored on users' OneDrive for Business (under Documents/Office Scripts), then maybe potentially use an HTTP triggered Power Automate flow to run the script through the "Run script" action.

Our current focus is more on the "no-code/low-code" spectrum so the API capability will probably come later. But we are open to suggestions and feature requests and will definitely adjust our priorities along the way based on customer feedback and requirements. Please feel free to share your thoughts/suggestions using the in-app feedback button in Excel on the web or the Microsoft Feedback portal.

1 Vote 1 ·