web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Refresh web power quer...
Power Automate
Answered

Refresh web power queries from Office Script with workbook content

(0) ShareShare
ReportReport
Posted on by 75
I wanted to refresh the query with power automate.
I have a flow that add data to the file and wanted this to be updated. It seems it's not possible to refresh it. The script will return success but doesn't actually refresh.
 
This is what my refresh script is :

function main(workbook: ExcelScript.Workbook) {
    let currentWorksheet = workbook.getActiveWorksheet();

    // Look at every named item in the workbook.
    workbook.getNames().forEach((namedItem) => {
        // Find names containing "Review".
        if (namedItem.getName().includes("DATA")) {
            namedItem.delete();
            console.log("DATA deleted");
           
        }
    });


    // Define Name data on workbook range on used range
    workbook.addNamedItem("DATA", currentWorksheet.getUsedRange(), "");
    
    console.log(currentWorksheet.getUsedRange().getAddress());
    workbook.refreshAllDataConnections();
    console.log("Refresh done");

}
My flow will run fine but the query is not refreshed.
 
Or is there another way to do it ?
 
Categories:
I have the same question (0)
  • Verified answer
    Ellis Karim Profile Picture
    11,691 Super User 2025 Season 2 on at
     
    "Unfortunately, refreshing a Power Query data connection in a script run through Power Automate is not currently supported: Troubleshoot Office Scripts running in Power Automate - Office Scripts | Microsoft Learn"
     
    Refresh not fully supported in Power Automate

    Office Scripts can't refresh most data when run in Power Automate. Most refresh methods, such as PivotTable.refresh, do nothing when called in a  flow. Workbook.refreshAllDataConnections only refreshes when PowerBI is the source. Additionally, Power Automate doesn't trigger a data refresh for formulas that use workbook links.

    Troubleshoot Office Scripts running in Power Automate - Office Scripts | Microsoft Learn

    Script methods that do nothing in Power Automate flows

    The following methods do nothing in a script when called through Power Automate. They still return successfully and don't throw any errors.

    Class Method
    PivotTable refresh
    Workbook refreshAllPivotTables
    Worksheet refreshAllPivotTables

     

     

    Ellis Karim Ellis Karim
    Blog | LinkedIn | Bluesky

  • Watever Profile Picture
    75 on at
    Thank you, that explain the issue
     
    Is there other function in Script that doesn't run in power-query ? other that data refresh ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard