Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Flow not working - Running a Excel Script in a OneDrive folder

(0) ShareShare
ReportReport
Posted on by 2

Hi All,

 

I setup a flow where "For a Selected File" for "OneDrive Business" - I can "Run Script" for "Excel". Even though the status of the flow shows "Succeeded" when I run the automate in the OneDrive file; the script is not working as expected. What could I be missing here?

 

PS - The script works properly when I run it in Excel; thus - no issues with the Script.

  • PJ-23071512-0 Profile Picture
    2 on at
    Re: Flow not working - Running a Excel Script in a OneDrive folder

    Adding more clarity:

    1) Here's the flow I'm going for:

    Nemesis_M6_0-1697133167831.png

    2) Once I select the file in OneDrive; I am able to select the flow I want to use:

    Nemesis_M6_1-1697133241631.png

    3) The job of the excel script is to just move the rows to the right (Note that the script works properly when applied to a sheet directly):

     

    function main(workbook: ExcelScript.Workbook) {
      // Get collection of worksheets in the workbook
      let worksheets = workbook.getWorksheets();

     

      // Loop through each worksheet and insert a column after column A
      worksheets.forEach(sheet => {
        let columnA = sheet.getRange("A1");
        columnA.getEntireColumn().insert(ExcelScript.InsertShiftDirection.right);
      });
    }

     

    4) Aim is to auto-save the sheet in OneDrive after the macro is applied. I'm nore if any flow step is required for it and thus, not added it

     

    5) Once i select the OneDrive sheet and run the flow - I see it as succeeded in my "Run History":

    Nemesis_M6_2-1697133483047.png

     

    However - I don't see the changes in my OneDrive sheet.

     

    Am I missing something here?

     

    PS - Hope this information can allow you to help me solve this. Happy to share more details!

     

    Appreciate the help!

  • Michael E. Gernaey Profile Picture
    43,285 Super User 2025 Season 1 on at
    Re: Flow not working - Running a Excel Script in a OneDrive folder

    @Nemesis_M6 

     

    We cannot really do anything with the description you gave. "is not working as expected" doesn't tell us anything.

     

    Pictures, Errors, what the script should does compared to what did it do, these details would help us.

     

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492