Search code examples
pythonazurejupyter-notebookpowerbi

Get data from Visualizations of Power BI to Jupyter Notebook


I am trying to create DQ reports for my Power BI report. I am using python to connect to my Power BI report. For this i am using this code. I am getting error on this:

from powerbiclient import Report, models
from powerbiclient.authentication import DeviceCodeLoginAuthentication
import pandas as pd

device_auth = DeviceCodeLoginAuthentication()

report_id = 'abc'
workspace_id = 'def'

report = Report(workspace_id=workspace_id, report_id=report_id, auth=device_auth)

pages = report.get_pages()

Exception: Power BI report is not embedded

Can someone please help how do i achieve this?


Solution

  • Initially I got the same error:

    enter image description here

    To resolve the error, include report._embedded=True in the code and modify it like below:

    from powerbiclient import Report, models
    from powerbiclient.authentication import DeviceCodeLoginAuthentication
    import pandas as pd
    
    device_auth = DeviceCodeLoginAuthentication()
    
    group_id = 'abc'
    report_id = 'def'
    report = Report(group_id=group_id, report_id=report_id, auth=device_auth)
    
    report._embedded=True
    
    report.get_pages()
    

    enter image description here

    enter image description here

    Reference:

    python - Exception: Power BI report is not embedded - Stack Overflow by Kotana Sai