Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to run python script on the remote server by clicking a button on the Power BI report.

Hello,
Need help to run python script which is on remote server or local machine using button in power bi report! 
Thanks in Advanced!  

3 REPLIES 3
lbendlin
Super User
Super User

Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?

Anonymous
Not applicable

@lbendlin - I have very simple web application (using flask) which I started local machine, it has API Call - In my example it is 'test_script' and that API is calling through power bi button - as action on button I selected web link passed value as "http://127.0.0.1:5000/test_script" . It working but it open to html page. My requirement is I just want to trigger that python execution not to open any html page. 

Below is python script. 

from flask import Flask, render_template
import datetime

app = Flask(__name__)

@app.route("/")
def hello_world():
    return render_template('home.html')

@app.route("/test_script")
def test_script():
    file = open(r'D:\workspace\Log Files\test.txt','a')
    file.write(f'{datetime.datetime.now} - The Script Ran \n')
    data = "Running Python Script"
    return render_template('home.html', data=data)
if __name__ == '__main__':
    app.run(debug=True)

here is web url I keep on power bi button

pratimak_0-1698853446258.png

 

That will always open a browser session.  Consider using a Power Automate visual instead, with a flow that runs the HTTP request.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.