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

Announcements

News and Announcements icon
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 79
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
    12,122 Super User 2026 Season 1 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
    79 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 471

#2
11manish Profile Picture

11manish 246

#3
David_MA Profile Picture

David_MA 238 Super User 2026 Season 1

Last 30 days Overall leaderboard