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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors