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 Platform Community / Forums / Power Automate / Flow not working - Run...
Power Automate
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.

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,963 Moderator on at

    @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.

     

  • PJ-23071512-0 Profile Picture
    2 on at

    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!

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

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 382

#2
Valantis Profile Picture

Valantis 370

#3
David_MA Profile Picture

David_MA 300 Super User 2026 Season 1

Last 30 days Overall leaderboard