A community member has associated this post with a similar question:
Power Automate Network sync during Excel Office Script While Loop

Only moderators can edit this content.

Office script does not fully run in power automate (while loop) works in excel

Anonymous
2023-02-14T19:30:06.92+00:00

I am working on a automation project for my department. This is my first attempt at using power automate / office script. There may be a better way to do this process. I am open to suggestions.

The sheet

I have created a random schedule for an internal process. I used a formula to sample the names randomly without replication. Then I count the total occurances of each name. Next to that I have a conditional column that is false if everyone is not assigned evenly.

The script

The script first changes two cells with a random number. This means the schedule will be shuffled at least once per run. Next, a while statement will keep shuffling until all names are assigned 4 times which turns cell E17 to 1 stopping the loop.

Whats different

The loop runs the first portion of code in power automate but does not run the while loop. The script runs properly in excel.

User's image

User's image

Microsoft 365 and Office Development Office JavaScript API
Microsoft 365 and Office Excel For business Windows
{count} votes