Did you notice the new run script action in the Excel connector when you use 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!
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.
Once you have done this you will get:
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.
Click on the New Script and your first script is there
And now when you try again we will see the Script 1 that we just created.
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.
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.
Daniel Laskewitz’s video about Scripts in Excel
6 thoughts on “Run Script with Excel in Power Automate”
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.
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.
the script belongs to the excel where is create?
if my flow overwrite the file every time…i lose the script or not?
How is you flow overwriting the file? If you do cell updates then you should be ok.
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…
specifically the scripts created are stored in oneDrive: \documents\officescripts: