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 To Run Script In ...
Power Automate
Unanswered

Flow To Run Script In XLSM File

(0) ShareShare
ReportReport
Posted on by 8

Hi all,

Trying to create a new flow to run a macro in an xlsm file saved to OneDrive for Business
Following instructions here
Getting this error:
The dynamic operation request to API 'excelonlinebusiness' operation 'GetSingleScript' failed with status code 'BadRequest'. This may indicate invalid input parameters. Error response: { "status": 400, "message": "Unable to parse script reference. clientRequestId: d450df0a-ca31-4283-bb5d-0c1ebddc6ebd", "error": { "message": "Unable to parse script reference." }, "source": "excelonline-scus.azconn-scus-001.p.azurewebsites.net" }

flow_error.png

What am I doing wrong?
Thanks,

-w

Categories:
I have the same question (0)
  • Rhiassuring Profile Picture
    8,690 Moderator on at

    Hard to say.. are you able to show us what your script looks like?

  • wsnyder Profile Picture
    8 on at

    What else can I show beyond the error message and the screenshot of the flow?

  • wsnyder Profile Picture
    8 on at

    Here is VBA:

    Option Explicit

    Sub foo()

    Dim wb As Workbook
    Dim ws As Worksheet

    Set wb = ThisWorkbook
    Set ws = wb.Worksheets(1)

    ws.Cells(2, 2) = "Demo"
    ws.Cells(3, 2) = 1
    ws.Cells(4, 2) = 2

    Set ws = Nothing
    Set wb = Nothing
    End Sub

  • Rhiassuring Profile Picture
    8,690 Moderator on at

    Thank you for posting your script. 

     

    I'm  not super familiar with VBA, but I noticed that when I put this into my workbook, it didn't show up in the dropdown - so I started looking into limitations of the script action.

     

    https://docs.microsoft.com/en-us/office/dev/scripts/develop/power-automate-integration

     

    It seems like it needs to be a main function, and, you have to call ExcelScript.Workbook as the first ...thing.

  • wsnyder Profile Picture
    8 on at

    Thanks,

    The documentation seem to be dealing with Scripts created in Office Script - that is a totally different beast altogether.

    I am trying to call an xlsm file saved to OneDrive for Business location and calling a VBA SubProcedure in that file. Documentation is found here for all of the steps I am following

  • Rhiassuring Profile Picture
    8,690 Moderator on at

    Ah I had no clue they were different - I am out of my element here, I will let another expert step in. Thanks for the link!

  • wsnyder Profile Picture
    8 on at

    Bump.
    Any thoughts?

    Thanks,
    -w

  • David_Lebosse Profile Picture
    2 on at

    Some .xlsm files, especially those with ActiveX or Form controls, may not work in the Excel online connector. Be sure to test before deploying your solution.

  • Yutao Huang Profile Picture
    Microsoft Employee on at

    Hello @wsnyder ,

     

    The "Run script" action will only run the "Office Scripts" you have recorded/created in Excel for the web and stored on your OneDrive for Business. You can indeed run an Office Script against a *.xlsm workbook that contains VBA macros, but it won't run the VBA code in that workbook.

     

    Unfortunately, we won't be able to run VBA macros with Power Automate. And I agree with you, Office Scripts is quite different from VBA. Here are some Differences between Office Scripts and VBA macros - Office Scripts | Microsoft Learn, if that helps.

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

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard