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 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:
I have the same question (0)

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard