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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Piyush_97
New Member

exporting the data from BI service using python

How i can export the data from power BI service using python??

or simply  how to write a code in python for POWER BI service  for exporting data in a file ??

1 ACCEPTED SOLUTION
ibarrau
Super User
Super User

Hi. PowerBi can't run python on demand. You have two alternatives to export data with python:

1- Prepare the code on the ETL. If you write a python transformation on PowerQuery, that means you need a gateway and a VM to run the transformations. That will let you write a code to export the current frame to the local filesystem of the VM and continue with the steps of the query to load the usual data. You can read more here: https://blog.ladataweb.com.ar/post/617917545084846080/powerbi-exportar-un-datos-automáticamente-al

2- Execute a DAX Query to the dataset with the PowerBi Rest API. There is a request on the API that let's you run a query against the model. You could run it, store it on a variable and export if you want. More info: https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries

If you like python I would suggest using a Python lib to make the code for the API easier. Something like SimplePBI that already has an object dataset to execute the query with a parameter to return a pandas dataframe.

I hope that helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

2 REPLIES 2
MallikarjunaBan
Helper III
Helper III

Thanks for writing this. My requirement is to export a Power BI visual content into a excel  file with 1.5 million records on average per day and save it in my local drive. Is there a way to do this as well.  specific for a table visual i need . i qlik view i could export 1million easily from table visual and need the same in power bi service .i tried using paginated report but it chokde all the memory and after 3 hrs no output as i have 42 columns in output but i could export for 5 columns only in paginated reports

ibarrau
Super User
Super User

Hi. PowerBi can't run python on demand. You have two alternatives to export data with python:

1- Prepare the code on the ETL. If you write a python transformation on PowerQuery, that means you need a gateway and a VM to run the transformations. That will let you write a code to export the current frame to the local filesystem of the VM and continue with the steps of the query to load the usual data. You can read more here: https://blog.ladataweb.com.ar/post/617917545084846080/powerbi-exportar-un-datos-automáticamente-al

2- Execute a DAX Query to the dataset with the PowerBi Rest API. There is a request on the API that let's you run a query against the model. You could run it, store it on a variable and export if you want. More info: https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries

If you like python I would suggest using a Python lib to make the code for the API easier. Something like SimplePBI that already has an object dataset to execute the query with a parameter to return a pandas dataframe.

I hope that helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.