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

Copper Contributor

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 = "$reportId/ExportTo"

$endpoint = "$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'





0 Replies