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 / Execute python script ...
Power Automate
Unanswered

Execute python script from Power Automate Flow

(2) ShareShare
ReportReport
Posted on by 6

How does one execute Python script from within a Flow ? 

Categories:
I have the same question (0)
  • Krishna92 Profile Picture
    Microsoft Employee on at

    @AnjanaM 

     

    You can make use of azure functions to achieve the scenario.

     

    You can bind the python script inside azure function and you can use flow to pass input to the azure function.

    The flow will call the azure function API and processing will be performed and the result will be returned back to flow.

    https://docs.microsoft.com/en-us/azure/azure-functions/supported-languages

     

    You can check the below mentioned document regarding the steps on how to create azure function.

    https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function

     

    You can use HTTP trigger to call the azure function from flow.

     

    If this information helps you, please consider giving a thumbs up and mark the solution as resolved

  • AnjanaM Profile Picture
    6 on at

    Is there any other option other than Azure functions ?

  • Krishna92 Profile Picture
    Microsoft Employee on at

    @AnjanaM 

     

    If you have a website which allows custom API, then you can built your python program on the website and can use the custom connector to connect to the website and pass information.

     

    You can pass the input parameters from flow and the processing will be done on the website and it will share back the information will which in turn be processed by flow and displayed to the end user.

     

    Hope this approach helps.

     

    If this information helps you, please consider giving a thumbs up and mark the solution as resolved

  • Dan_Edens Profile Picture
    10 on at

    I achieve this with the onedrive file connector.

    Create directories in your onedrive root.

    'root/,run/results/'

    and use a file watcher to monitor file creation in 'root/.run'

    than use the onedrive connector to create a new file with contents:

    "python script.py > /results/script.txt"

     

    Than create a onedrive trigger as another flow to watch the results folder or whatever you want to do with it.

     

  • VswaldB Profile Picture
    24 on at

    @Dan_Edens 

    Hi, I'm very interesting in your method, but I tried to follow, but only get file content with string "python script.py > /results/script.txt", could you please share more details on how you do this? 

     

    many thanks. 

  • costa86 Profile Picture
    6 on at

    Use "run powershell script" instead, then type "python %pyFile%" (no quotes) in it.

  • VswaldB Profile Picture
    24 on at

    you mean using Azure Automation? or what connector do you use, do you have an exemple maybe?

  • costa86 Profile Picture
    6 on at

    No need for that. The python script runs locally, being executed by power shell solely.

    1.Create a variable, let us say "x", and store the path to your python script in it.

    2.Use the "run power shell script" action, and type "python %x%" inside it.

  • VswaldB Profile Picture
    24 on at

    Thanks a lot for your help, but I can't seem to find an action called "run power shell script"...do you by any chance know where I did wrong?

     

  • Daninel Profile Picture
    2 on at

    Hi VswaldB ,

    I think costa86 is using Power Automate Desktop rather than Power Automate cloud fow.

    In PAD it's rather easy to excute python script. You can use the way as mentioned by costa86 or if it's just simple script you can also chooose action "Run Python script" by directly input your codes there.

     

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