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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
amaaiia
Super User
Super User

How to export data from report visualization into Fabric notebook

Hi.

I have a report in a Fabric workspace. The report reads data from a DirectLake semantic model, and it contains a table visualization. I want to access the data from that table in a notebook. I have a registered app (client_id and client_secret) that has Contributor role on my workspace, so it has access to both report and semantic model data. I have found a couple of ways to retrieve this data from the notebook via API, but both return a 403 Forbidden error.  

 

The first thing I do is obtain a token with the scope=https://api.fabric.microsoft.com/.default and grant_type=client_credentials for this registered app using its client_id and client_secret. The app has access to the workspace (Contributor rol). Then, I try to retrieve the data with two different options:

 

reportId = "XXXXXX"
visualId = "YYYYYY"
token = "ZZZZZZ"
 
fabric_url = 'https://app.fabric.microsoft.com/api/reports/{reportId}/exportData'
 
headers = {
    'Authorization': f'Bearer {token}',
    'Content-Type': 'application/json'
}
 
params = {
    'visualId': {visualId},
    'format': 'CSV'  
}
 
response = requests.get(fabric_url, headers=headers, params=params)
 
if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(response.status_code)

 

 

It returns 403 forbidden.  

 

TENANT_ID = ""
WORKSPACE_ID = ""
REPORT_ID = ""
pageId = ""
VISUAL_ID = ""
access_token=""
 
API_URL = f"https://api.powerbi.com/v1.0/myorg/groups/{WORKSPACE_ID}/reports/{REPORT_ID}/pages/{pageId}/visuals/{VISUAL_ID}/exportData"
 
headers = {
    "Authorization": f"Bearer {access_token}",
    "Content-Type": "application/json"
}
 
response = requests.get(API_URL, headers=headers)
 
if response.status_code == 200:
    data = response.json()
    print(data)  
else:
    print(f"Error: {response.status_code}, {response.text}")

 

 It returns 403 forbidden.  

 

The app has access to the workspace containing the report and to the data, 

 

What am I doing wrong? 

1 ACCEPTED SOLUTION
v-sgandrathi
Community Support
Community Support

Hi @amaaiia,

Thank you for being a part of the Microsoft Fabric Community.

 

As per my understanding once confirm that the app has the necessary permissions to access the report and export data. Ensure that your app includes Dataset.Read.All and Report.Read.All API permissions.

Additionally, make sure to use the correct Power BI API endpoint for exporting report visualization data. This will ensure that the data is exported accurately and efficiently.

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

 

Regards,

Sahasra.

 

 

View solution in original post

4 REPLIES 4
v-sgandrathi
Community Support
Community Support

Hi @amaaiia,

Thank you for being a part of the Microsoft Fabric Community.

 

As per my understanding once confirm that the app has the necessary permissions to access the report and export data. Ensure that your app includes Dataset.Read.All and Report.Read.All API permissions.

Additionally, make sure to use the correct Power BI API endpoint for exporting report visualization data. This will ensure that the data is exported accurately and efficiently.

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

 

Regards,

Sahasra.

 

 

Hi @amaaiia,

 

May I ask if you have gotten this issue resolved?

If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

 

Thanks for using Microsoft Fabric Community Forum.

Hi @amaaiia,

 

As we have not received a response from you yet, I would like to confirm whether you have successfully resolved the issue or if you require further assistance.

If the issue has been resolved, please mark the helpful reply as a "solution" to indicate that the question has been answered and to assist others in the community.

Thank you for your Understanding!

Hi @amaaiia,

 

I wanted to follow up on our previous suggestions regarding the issue. We would love to hear back from you to ensure we can assist you further.

If my response has addressed your query, please accept it as a solution and give a ‘Kudos’ so other members can easily find it. Please let us know if there’s anything else we can do to help.

.Thank you for reaching out! The Microsoft Fabric Community is here to help.

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 FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric 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.