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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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 II
Helper II

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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