Search code examples
pythonpandasdropboxpower-automate

Running Python triggered from Microsoft Flow


Would anyone know what is the approach to call Python application/script (which relies on imported libraries like pandas) from Microsoft Flow?

The complete problem is like this. Client uploads something to Dropbox (it is how his ERP works). This action is linked to our Microsoft Flow so whenever he uploads it, Microsoft Flow registers it (now it just redirects it to us). What I need to do after is run the Python application/script on that file in Dropbox after he uploads it. I can put my Python directly into that Dropbox. What I do not know is how to trigger it and ensure it runs (is interpreted).

Thank you for any suggestions.


Solution

  • To execute any code locally from MS flow, install and configure On premises gateway as per the instructions in the below link

    https://learn.microsoft.com/en-us/flow/gateway-reference

    Create a flow to copy the new file from dropbox to the local filesystem

    Create a watcher to the local directory for any new file creation and execute the python code for the new file.

    Refer the below link for the powershell script execution. Similar process can be designed for python

    https://flow.microsoft.com/en-us/blog/flow-of-the-week-local-code-execution/