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

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

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard