Home / Power BI / Embed Power BI Reports In Jupyter Notebooks

Embed Power BI Reports In Jupyter Notebooks

On this Page

Social Shares

Recently Microsoft has added a new feature that allows you to embed your reports right into your jupyter notebook cells. This new highlight lets you embed your reports, dashboards, report visuals, Q&A visuals in jupyter notebooks for in-depth exploration.

Before embedding your reports in Jupyter notebooks, create your Power BI reports and then publish them to the Power BI service.

Once the reports are prepared and published then comes the embedding part. The embedding can be achieved with the new python package – Power BI client. You can install this open-source python package from PyPI or just execute the following command in the command prompt.

Pip install Power BI client

Now we will switch to jupyter notebooks.

  1.  From the recently installed package import report and models.

# import required packages
from Power BI client import Report, modelsAuthenticate yourself against Power BI

2. Authenticate yourself against Power BI against Azure.

# Import the DeviceCodeLoginAuthentication class to authenticate against Power BI
from powerbiclient.authentication import DeviceCodeLoginAuthentication

# Initiate device authentication
device_auth = DeviceCodeLoginAuthentication()

Once you execute the above code, you will be asked to authenticate yourself. To sign in, go to this URL – https://microsoft.com/devicelogin and enter the given code to authenticate.

3. Fetch the workspace id and the report id from the Power BI service. If you open your report in the Power BI service you can find these values in the web URL of your report.

# fetch the variables
group_id = “# enter your workspace ID here”
report_id = “# enter your report ID here”

4. Create a power bi instance and load the report in the notebook cell.

# create the report instance
report = Report(group_id=group_id, report_id=report_id, auth=device_auth)
# report output
report

Author By

Kamal Sharma

Kamal brings over 20 years of experience in data analytics and business intelligence. He has led the design and implementation of analytics solutions across operations, financial reporting, and performance improvement initiatives. With a background in business statistics and Six Sigma, his work focuses on applying data in a structured and practical way to solve real business challenges.

Author By

Kamal Sharma

Kamal Sharma

Kamal brings over 20 years of experience in data analytics and business intelligence. He has led the design and implementation of analytics solutions across operations, financial reporting, and performance improvement initiatives. With a background in business statistics and Six Sigma, his work focuses on applying data in a structured and practical way to solve real business challenges.

Decision-Ready Analytics

Turn your OEE dashboard into a decision system.

Book a 30-minute working session with our manufacturing analytics team.
Translate »