Power Automate: update an excel file with Power BI
In this article, I will explain the way to update an excel file from Power Automate in an automatic way. If you prefer to do it via a button, read Power Automate: update an excel file from Power BI. First, from an excel file, I have to create a table that is connected to Power BI (read Excel: connect to Power BI) then a script to refresh the connection by clicking on “automate -> new script”:

Delete everything and put the below code:
function main(workbook: ExcelScript.Workbook) { workbook.refreshAllDataConnections(); }
I will change the name before to save it:

NOTE: for an effective purpose, the script should only contain the refresh line, if I want to add more codes like copy, delete, etc. I have to create another script
Once done, from the Power Automate webpage, I will click on “create” then I will choose one of those 2 options:

Based on the choice, the first popup window will be different but after, it is the same:
- Automated cloud flow: to select if I want to update the excel table automatically based on a specific action. Amongst the options, I select the one that fits better to my need then click on “create” to get this view:
Click on the option to fill all fields from the left panel that just appears:
- Scheduled cloud flow: to select if I want to update the excel table automatically based on a date. Click on “minute” to see more options. For my example, I select “week”:
Click on the option to make appear the left panel then fill only the “time zone” field:
Let’s keep with the date. From now, the following steps are the same for both. Click on the “+” to add a new step then in the “search” field, put “run script” to select this option:

Fill all the fields:

On the top right side, click on “save” then on “test”:

If all go well, this message will show:

To run my flow in live action, click on “back” (top left, next to the name):

Click on “run” then I can see the status of it:

And in my excel, I can see that the update has been done:


Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...
-
Refresh Power BI
From the Power BI Service, I can set refresh but, for instance, there is no option to do it monthly or each time a change is made...
-
Power BI alerts to be sent by email from an excel file based on condition
I will explain how to send a list of emails from an excel file after creating alerts...