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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PeacefulBeing
Frequent Visitor

Download Power BI report in code

Hi everyone,

 

Is it possible to download a Power BI report in code (C# for example)?

We would like to automate a download of a existing Power BI Report.

 

Thank you in advance for your feedback!

Kind regards.

1 ACCEPTED SOLUTION

Sorry I misunderstood.

 

Currently, the only support for export-to-pdf is in Power BI Desktop and not in the Power BI Service. Unfortunately, there is no way to automate generating PDF files with Power BI Desktop. I do not think what you want will be possible until the Power BI team adds export-to-pdf capabilities to the Power BI Service and also support to call it through the API. This feature is on the Power BI team's roadmap but I have no idea when we might see this in preview.

View solution in original post

5 REPLIES 5
umeshlade
New Member

Is is possible to download power BI report using SSIS script or using C#?

I want to automate report download from power bi server by passing dynamic parameter. 

 

@PeacefulBeing @TedPattison  how you done this in your application 

TedPattison
Employee
Employee

Yes, you can use the Power BI SDK which provides methods in PowerBiClient.Reports. Here is an example.

 

 

PowerBIClient pbiClient = GetPowerBiClient();

var reportStream = pbiClient.Reports.ExportReportInGroup(appWorkspaceId, report.Id); string filePath = @"C:\tempExport\" + report.Name + ".pbix"; FileStream stream1 = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite); reportStream.CopyToAsync(stream1).Wait(); reportStream.Close(); stream1.Close(); stream1.Dispose();

 

 

Hi @TedPattison

 

First of all thank you for your reply and info/code sample.

Excuse me, i rephrase, can you download a PDF/PNG from a report in C# from a report or dashboard?

 

Sorry I misunderstood.

 

Currently, the only support for export-to-pdf is in Power BI Desktop and not in the Power BI Service. Unfortunately, there is no way to automate generating PDF files with Power BI Desktop. I do not think what you want will be possible until the Power BI team adds export-to-pdf capabilities to the Power BI Service and also support to call it through the API. This feature is on the Power BI team's roadmap but I have no idea when we might see this in preview.

No, it is my fault for not stating my question properly 🙂

Thank you very much for both replies as they helped me both!

 

kind regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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