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 Automate
Unanswered

Running Excel Script

(0) ShareShare
ReportReport
Posted on by

I am trying to run an Excel Office Script to perform a "refresh all". However, even though it says its run, the file does not refresh. One of my files takes a while to refresh so I'd like to put a pause or sleep into the script. I can't use VBA as Power Automate does not like macro-enabled workbooks.

 

This is the normal script:

 

function main(workbook: ExcelScript.Workbook) {
  // Refresh all data connections
  workbook.refreshAllDataConnections();
  }

This is the one I tried to add a sleep to:

 

function main(workbook: ExcelScript.Workbook) {
  // Refresh all data connections
  workbook.refreshAllDataConnections();
  sleep(20);
}
function sleep(seconds: number) { let waitUntil = new Date().getTime() + (seconds * 1000);
 while (new Date().getTime() < waitUntil) { }; 
 }

 

 

 

Categories:

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 289

#2
11manish Profile Picture

11manish 282 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 119

Last 30 days Overall leaderboard