Showing results for 
Search instead for 
Did you mean: 
Not applicable

Office Script Error: "Script not found. It may have been unshared or deleted"

 I am working on  a Power Automate Run Script process which takes a number as a parameter and outputs a JSON object. I am having an error of "Script not found. It may have been unshared or deleted" whenever someone other than me is running the flow. The flow is triggered from PowerApps.


Here are the things I have done so far:

1. Made sure that workbook is shared and has edit (the person is even the owner now of the folder and the file itself)

2. Made sure that the script is shared enabled also

3. I even shared the power automate ownership to the person

4. Tested with other person with same permission configuration

5. Tested to run the script by its own both by me and that person and it's running okay except if the person run it through power automate



Community Support
Community Support

Hi @Anonymous,


What's the script do? Do you mind sharing the script?

How about trying to delete the script then recreate a new one to test?


Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Not applicable

hi @v-litu-msft 

What the script does is to create an array of object, shuffle it, and get the top items in the list. 

I tried recreating it as well.

Here is the script:

function main(workbook: ExcelScript.Workbook, top: number = 1😞 Result {
    let selectedSheet = workbook.getWorksheet("Participant");


    let selectedRange = selectedSheet.getRange("A1").getSurroundingRegion().getValues();


    let pool: Winner[] = [];


    for (let i = 1; i < selectedRange.length; i++) {
        let range = selectedRange[i];
        let upinO = range[3].toString();
            upin: upinO.substring(0,upinO.indexOf('@')),
            name: range[4].toString(),
            department: range[5].toString(),
            eligibility: range[7].toString(),


    var shuffledPool = shuffle(pool.filter(isEligible));


    console.log(shuffledPool.slice(0, top));


    let result = {
      eligibleCount: shuffledPool.length,
      winners :shuffledPool.slice(0, top)
    return result;




interface Result{
  winners: Winner[];
  eligibleCount: number;


interface Winner {
    name: string;
    upin: string;
    department: string;
    eligibility: string;


function isEligible(element, index, array) {
  return (element.eligibility == 'ok');


function shuffle(array) {
  var currentIndex = array.length, temporaryValue, randomIndex;


  // While there remain elements to shuffle...
  while (0 !== currentIndex) {


    // Pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex -= 1;


    // And swap it with the current element.
    temporaryValue = array[currentIndex];
    array[currentIndex] = array[randomIndex];
    array[randomIndex] = temporaryValue;


  return array;

Hi @Anonymous ,


Unfortunately, at this moment, the Run script action can only access and execute the scripts created by yourself but not shared scripts.


Therefore, when you're sharing a flow with other people, you'll need to also share the original connection (the one created under your name) embedded in that flow. The original connection can make sure the action will run on-behalf-of you so it can have access to your script.


This is the default sharing behavior in Power Automate so presumably it should work for you. But can you please double check if the embedded connection is still pointing to your account?


Screenshot - 12_14_2020 , 10_32_59 AM.png



Hi Yutao,
I added the other user as co-owner to the flow, and yet the flow is failing at Run Script stage. Any suggestions?

Resolver I
Resolver I

Hey Neha, 
Were you able to find the fail reason? I'm facing the same issue now. 

@Serbay , @Anonymous , @Neha2904


Please see if the steps below can solve the problem:


1. On the details page of the flow, click the "Edit" button next to "Run only users":


Screenshot - 2_26_2021 , 9_04_49 AM.png


2. On the "Manage run-only permissions" panel, make sure to select "Use this connection (...)" from the "Connection Used" dropdown list.


Screenshot - 2_26_2021 , 9_03_54 AM.png



3. Save the settings


4. Ask another user to try it again.


These settings will make sure the flow runs on-behalf-of the original owner of the flow.


Hope this helps!



Resolver I
Resolver I

Hi, Yutao 
Thanks a lot for your response! Definitely, this solution will be helpful on some of my flows. But Unfortunately, there is no option as "Run only users for me" since I use the trigger as "PowerApps". I guess this is valid only with some of the triggers.
Do you have any idea how can we make sure a flow which has a PowerApps trigger will run on the behalf of the owner, not the user?

Thanks a lot!

Hey @Serbay ,


Yes indeed it seems the "Run-only" settings only supports very few triggers (the manual button trigger being one).

I did a bit experiments and figured out a solution that worked for me -


* Firstly, you'll need to create all your flows and PowerApps apps within a "Solution". You can create a new solution from "Solutions/New solution":



* Within this new solution, create a button-triggered flow that runs Office Scripts. Let's call it "Child flow". Please note this flow requires to have a last action to respond to a PowerApp or flow.

Child flow.png


* Configure this child flow with run-only users settings as described in my previous response. Make sure to choose "Use this connection ...".


* Within the same solution, create another flow with the PowerApps trigger. This flow will be triggered by your PowerApps app. In this flow, add a step to run the child flow you've just created above:

Parent flow.png


* Within the same solution, create your PowerApps app. Configure your PowerApps button to run the second flow (the parent flow).


* Now share the PowerApps app with another user, ask them to try it out, and see if the Run script action in the child flow can work properly.


Hope this can also work for you!



Resolver I
Resolver I

Hi, Yutao 
I really appreciate your help and responses. I have a single obstacle now, How can we pass the output of one of the actions from PowerApps triggered flow into child flow? I need to use the body of the parse JSON action in child flow.





Best Regards,

Hey @Serbay -


Please see if this works:


* In the child flow, add a text input (or whatever input type you need) to the manual trigger. Let's call it "Input". And pass that input value to the consuming actions after it. For example, here I'm passing it directly to the Run script action:



* In the parent flow (the PowerApps triggered flow), a new argument named "Input" to run the Child Flow will show up.





Regular Visitor

After Support call from MS support team, I found correct process to add both flows accurately.


1. Create a Child flow with Manual trigger with input -> add initialize variable and set value as input from manual trigger -> Add respond to a PowerApp action -> save the child flow

2. Create a Parent flow using PowerApp trigger -> Add run child flow action -> set value from Powerapp form -> Add respond to a PowerApp action and get input from Run Child flow action-> save the parent flow.

3. Add Parent flow to the Powerapps button.

4. Test your both flow by trying to hit PowerApp button in PowerApps form. 

5. If step 4 runs without any error, go for additional action sets in the child flow. Please make sure to add new connection reference on actions and select connection from the "Run only users " link button 





Regular Visitor

Hi All,

I created a version and it worked. you can follow up this steps:


Child flow
1. Create a Child flow
2. Add Manually trigger a flow
3. Add input to Manually trigger a flow- do not assign value to input



4. Initialize a variable
5. Value for variable will be output of input in Manually trigger a flow



6. Run excel script
7. Add output of variable as a excel script value



8. At the end, Add respond to a PowerApps or flow


Parent flow

1. Create a Parent flow
2. Add run child flow

3. Set child flow value with output of variable in child flow



4. Add Parent flow to the PowerApps button



Hamed Yousefi

Hey folks, just wanted to share an update with you all - I believe the new "Power Apps (V2)" trigger is supporting "Run only users" settings now. This means you should be able to build and share a Power Apps + Power Automate + Office Scripts solution without the need to introduce an extra child flow anymore!


So here is my flow that accepts a text input from PowerApps, process it through an Office Script, then return back to PowerApps. There is no need to do the tedious parent/child flow workaround!



Of course, you still need to config the "Run only users" for this flow so once it is integrated into a PowerApps app and shared out, it can work correctly for other users.


Please give it a try and let me know how it works!

Not applicable

Hello! I can confirm it works like a charm ! 











You saved me a few hours and some hairs. 😄

Hello Microsoft,

I got the same error message "Office Script Error: "Script not found. It may have been unshared or deleted"
when another ppl run the script via flow which is called from PowerApps
And I also created new flow with PowerAppsV2 in solution, I tried to add the new flow in PowerApps but I could not see it. Can you pls suggest how to call the new flow in solution in PowerApps ? 

Thank you!

@nanthant -


So I assume you shared your flow with another user, right? Do you recall how you configured the shared flow? Did you set it so another user would need to provide their own connection (credentials) to run it, or did you set it so the shared flow would continue to use your connection? The Run script action currently doesn't yet support the first case (another user using their own connection to run your script).

Regular Visitor

Hi Yutao,

Thanks for your response

I created new flow with PowerApps V2 again and configured connection to me, it works fine. 




How did you get the input from power apps canvas in this Power Apps V2?



I already resolve the problem of script not found. But my flow isn't getting the input from my power apps canvas.

@rick_liz - in the "OnSelect" action in your Power Apps, please try passing the parameter into the flow without using the braces "{...}". You should just directly pass the text value into the ".Run(...)" function like this: FD_M_New.Run(TextInput_Company.Text).


BTW, if your flow needs to accept multiple parameters, you can just pass them in one by one. Here is a good video tutorial I found about using PowerApps V2 trigger with multiple parameters: Power Apps(V2) Trigger In Power Automate - Power Platform Community (


Please give it a try and let me know how it goes!

Helpful resources


Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Results posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (2,423)