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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
AnonymousUser
Frequent Visitor

Publish a PBIX file from sharepoint to a workspace in powerBI.

Hello,

 

We have a sharepoint site where .pbix reports are located. We are trying to find a way to upload/publish the files back to the powerBI service workspace by either using flow or a custom connector in powerapps (to use the PowerBI rest API). We want to make the process automatically instead of having to upload the file manualy. Is there a way to make this possible? 
Thanks in advance

6 REPLIES 6
AnonymousUser
Frequent Visitor

I'm very new to all of this so I'm trying to find out the best way to do this. 
As of now I tried it with Power Automate to do a HTTP GET in sharepoint to find the reports, but I can't seem to find them, I only get some .pptx files back. Can the Power BI REST API directly do a GET for these reports? 
I also tried it with powerapps but I think I need to make a custom connector for that, but I'm not sure. 
So right now I'm not very far into the process.

This is a rather complex topic for a new user.  Please read up on the available REST API calls like 

Imports - Post Import In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Imports - Create Temporary Upload Location In Group - REST API (Power BI Power BI REST APIs) | Micro...

 

or their equivalent for shared capacity.

Up untill now I have been reading up and trying to get it working. I created a python script to download the .pbix file to a local folder via the sharepoint RestAPI because directly importing the file from sharepoint seemed impossible. I created an app in AAD and the Power BI rest API works with simple get calls. I also created a blob storage account to upload the local files to with a python script. But now I want to do an import of the files into the service but I'm not sure if it is even possible (because a filepath is not suported)? Is this possible and how?

Not sure if involving Python in all this will make things easier for you.  You should assume that the standard API calls have more functionality and better performance. Are you having trouble with POST calls?

I have been trying to get it into python because that is the requirement I got. But yes, I have problems trying to do a Post call to import the file. The file is in the blob storage.

I use

data = blob_client.download_blob()
data = data.readall()
to get the data in binary format

the header that I use:  
headers = {
'Content-Type': 'application/octet-stream',
'Authorization': f'Bearer ' + access_id}

import_url= 'https://api.powerbi.com/v1.0/myorg/groups/<my group id>/imports'
 
and this is the request: 
response = requests.post(import_url, headers=headers,data=data)
 
But this gives me a 400 response. 
 
 



lbendlin
Super User
Super User

yes, as you said you can use the Power BI REST API for that.  What have you tried and where are you stuck?

Helpful resources

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

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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