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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
ajinkya_MDA
Frequent Visitor

Error while using the Export API to export Paginated report located on PBI Service into .xlsx file

Hi folks,

I am trying to run this script to export paginated report into an excel file using PowerShell but I am getting an error, Could anyone please help me?

Things which ran successfully using PowerShell : Logging into PBI Service , Retrieving Workspace and Report ID

$reportId = "7abc73b4-0bad-4edb-8f52-xxxxxxxxxxxx"

$groupId = "04a7c8b4-9c13-4838-b812- xxxxxxxxxxxx "

$endpoint = "https://api.powerbi.com/v1.0/myorg/reports/$reportId/ExportTo"

$endpoint = "https://api.powerbi.com/v1.0/myorg/groups/$groupId/reports/$reportId/ExportTo"

$body = @"

{

    "format": “XLSX"

}

"@

$headers = Get-PowerBIAccessToken

$headers.Add("Content-type", "application/json")

$response = Invoke-RestMethod -Headers $headers -Uri $endpoint  -Body $body -Method 'Post'

$response

 

Error:

ajinkya_MDA_0-1624441845767.png

Thanks in Advance!

 

1 REPLY 1
v-robertq-msft
Community Support
Community Support

Hi, 

According to your detailed error message, it seems that you met the (400) bad request error, you can follow this document to troubleshoot your problem:

https://airbrake.io/blog/http-errors/400-bad-request

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.