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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors