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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
solvisig
Advocate III
Advocate III

Query power bi dataset from Python or R

Is there any way to query PowerBI dataset from R or Python for data analysts?


I havent found any library to help me with this but seeing the latest news with improvements on the excel connector I´m hopeful there may be a solution for achieving this.

3 REPLIES 3
caninetiger
Frequent Visitor

Hey @solvisig, have you ever looked at the Pyadomd library? It requires some setup from the Power BI side but you can use that in combination with the msal library for authentication, to query Power BI datasets. 

Covenant-bi
Helper I
Helper I

Yes, there are a few ways to query Power BI datasets from R or Python.

  • Use the Power BI API. The Power BI API is a RESTful API that allows you to interact with Power BI datasets from any programming language. There are libraries available for R and Python that make it easy to use the Power BI API.
  • Use the Power BI Desktop Query Editor. The Power BI Desktop Query Editor allows you to connect to a variety of data sources, including Power BI datasets. You can then use the Query Editor to query the data and export it to a file or a variable in R or Python.
  • Use a third-party library. There are a few third-party libraries that allow you to query Power BI datasets from R or Python. These libraries typically provide more features and functionality than the Power BI API or the Power BI Desktop Query Editor.

Here are some of the libraries that you can use to query Power BI datasets from R:

  • RPowerBI is a library that provides a high-level interface for querying Power BI datasets from R.
  • pbi.r is another library that provides a more low-level interface for querying Power BI datasets from R.
  • pyodbc is a library that allows you to connect to ODBC data sources from Python. You can use pyodbc to connect to a Power BI dataset that is published to an ODBC endpoint.
  • powerbi-connector is a library that provides a high-level interface for querying Power BI datasets from Python.

Hi, These libraries you mention do not allow me to query Power BI datasetes. They only interact with the Power BI API allowing me to work with administrations tasks from R.
I am looking for something to work with the data in the datasets.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.