Run Script in Excel from a Power Automate flow

Did you notice the new run script action in the Excel connector when you use Power Automate?

Run Script with Excel in Power Automate

Office Script settings in Microsoft 365

When you start with this action you will most likely bump into the There’s a problem error. Within the sea of junk you might find the clue!

Run Script with Excel in Power Automate

The important line is:

Office Scripts Platform is disabled.

To enable Office Scripts you will have to go to your Office 365 Admin Center.

In the admin center go to Setting -> Org settings and search for office scripts and then tick the box. This will Let users automate their tasks in Office on the web.

Run Script with Excel in Power Automate

Once you have done this you will get:

Run Script in the excel connector

Now we got to a blank screen kind of thing!

What can we do with Scripts?

Run Scripts in the Excel connector

Open your excel file on office online and you will notice the automate option.

Run Script with Excel in Power Automate

Click on the New Script and your first script is there

Run Script with Excel in Power Automate

And now when you try again we will see the Script 1 that we just created.

Run Script with Excel in Power Automate

If you want to learn about this scripting language in excel then you could always start by using the record option when you create a new script.

I remember many years ago developing an app in Excel. I wouldn’t recommend using this kind of scripting to develop full blown apps in Excel. The run Script is more for small steps that you want to complete in an Excel.

Run Script with Excel in Power Automate

Just as an example. Creating Tables in Excel from a flow can be painful, but if you can create them using a script inside your Excel then that might quite well work.

This Run Script action gives us unlimited options in Excel, however if you are serious about your data, I would still recommend using a proper database.

See also

Daniel Laskewitz’s video about Scripts in Excel


Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe to get the latest posts sent to your email.

6 thoughts on “Run Script with Excel in Power Automate”
  1. Hi,
    Thanks for this article. Very informative.
    Just wondering if there’s any sort of security risk in having Office Scripts enabled at the tenant level.
    Is there a possibility to limit the ability to run scripts to particular locations / sites / libraries, or is this kind of security restriction implied through the access level given to the spreadsheet itself?

    Thanks in advance.

    1. Hi Michael,

      You can only enable and disable the scripting tenant wide. The main risk is people uploading excel files with unwanted scripts.

      People uploading malicious excel files is going to be something that you can’t restrict with permissions.

  2. hello

    the script belongs to the excel where is create?
    if my flow overwrite the file every time…i lose the script or not?

  3. hello

    i auto reply mi question: NO.
    i create(overwrite) the file every time a certain mail comes with the attachment…but the flow still working every time, so the script created remains…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading