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 August 31st. Request your voucher.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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