Run Script in Excel from a Power Automate flow

Run Script with Excel in Power Automate

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

Run Script with Excel in Power Automate 1

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 2

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 3

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 4

Click on the New Script and your first script is there

Run Script with Excel in Power Automate 5

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

Run Script with Excel in Power Automate 6

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 7

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

2 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.

Leave a Reply

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

%d bloggers like this: