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
Cherubelk
Frequent Visitor

Exporting Paginated Report to excel, pdf, and json using Power BI API, with parameters passed

Hello! I am working on using this API to export paginated reports with select parameters to excel, pdf, or json. I have this working by being able to export paginated reports that have no parameters using this call. Although, I am unable to get it working with paginated reports that have parameters.

 

Export Power BI embedded analytics paginated reports API - Power BI | Microsoft Learn


What I am sending in my request:

parameters = [
    {"name": "Department", "value": "dep_name"},
    {"name": "Report_Tester", "value": "N"},
]

export_data = {
      "format": "XLSX",
      "parameters": parameters
}

Error message: 

error, {'code': 'rsParametersNotSpecified', 'message': 'RootActivityId(-): Some parameters do not have valid values. Parameter Param_Report_20_Usage_Department is missing values. Parameter Param_Report_20_Usage_Report_5f_Tester is missing values.', 'details': []}

Doing this in Python. Is this the correct format of how parameters should be sent to Paginated reports?

Thank you in advance!

1 ACCEPTED SOLUTION
v-sdhruv
Community Support
Community Support

Hi @Cherubelk
You can try troubleshooting the issue with-

  1. Verify Parameter Names:

    • Open your paginated report in Power BI Report Builder.

    • Navigate to the Parameters pane.

    • Confirm the exact names of the parameters. Note that parameter names are case-sensitive and may include underscores or other characters.
      Power BI -Export Paginated Report.

      2.You can also Test with Known Values:

      Before deploying the solution, test the API call with known parameter values to ensure that the report exports as expected.

      Hope this helps!

      If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
      Thank You

 

View solution in original post

4 REPLIES 4
v-sdhruv
Community Support
Community Support

Hi @Cherubelk
You can try troubleshooting the issue with-

  1. Verify Parameter Names:

    • Open your paginated report in Power BI Report Builder.

    • Navigate to the Parameters pane.

    • Confirm the exact names of the parameters. Note that parameter names are case-sensitive and may include underscores or other characters.
      Power BI -Export Paginated Report.

      2.You can also Test with Known Values:

      Before deploying the solution, test the API call with known parameter values to ensure that the report exports as expected.

      Hope this helps!

      If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
      Thank You

 

Thank you, I was able to export the report prior to this post but it very similar to how I was able to export.

At first I had created a Paginated Report in Power BI Service, this is the report I was using to test this export. The report created in Power BI Service was able to download and export when it had no parameters. After adding parameters to that same report and trying to export it I was unable to.

Given another Paginated Report that was developed with Power BI Report Builder, with defined parameters, I was able to export the report.

Maybe a bug, but parameters are not recognized by the Power BI REST API given that the pagniated report and parameters were created using Power BI Service and not Power BI Report Builder.

v-sdhruv
Community Support
Community Support

Hi,
Considering  that you've already reviewed the considerations and limitations of exporting paginated reports,, and still not able to export Paginated report-
1.Verify Parameter Names:
Ensure that the parameter names in your API request exactly match those defined in your paginated report. Parameter names are case-sensitive and must include any special characters or spaces.
2. Modify your parameters list in the API request to reflect the correct parameter names.
For example:
parameters = [
{"name": "Param_Report_Usage_Department", "value": "dep_name"},
{"name": "Param_Report_Usage_Report_Tester", "value": "N"},
]
Hope this helps!
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank You!

Thank you for the help, but I already tried this and getting the same response. 

To give more context this is what I am starting with:
access_token is from API that is already added as a member to a Premium Per User Workspace

export_url = f'https://api.powerbi.com/v1.0/myorg/groups/{group_id}/reports/{report_id}/ExportTo'

headers = {
            'Content-Type': 'application/json',
            'Authorization': f'Bearer {access_token}'
          }

parameters = [
{"name": "Department", "value": "dep_name"}
]

export_data = {
      "format": "XLSX",
      "paginatedReportConfiguration": {
        "parametersValues": parameters
}
}
Report is in a Premium Per User Workspace with the following Parameter, want to select one or many.
Cherubelk_1-1747063122128.png

 

 

My export function that will post export request, verify the request, then start the export.

def export_report():
    response = requests.post(export_url, headers=headers, json=export_data)

    if response.status_code == 202:
        print('Export request accepted, waiting for completion...')
        
        
        status_url = response.headers['Location']
        
        while True:
            status_response = requests.get(status_url, headers=headers)
            
            if status_response.status_code == 200:
                
                export_status = status_response.json()
                for k, v in export_status.items():
                        print(f'{k}, {v}')

                if export_status['status'] == 'Succeeded' and export_status['percentComplete'] == 100:
                    
                    resource_location = export_status['resourceLocation']
                    file_response = requests.get(resource_location, headers=headers)
                    
                    if file_response.status_code == 200:
                        with open(f'file_export_test{export_status["resourceFileExtension"]}', 'wb') as file:
                            file.write(file_response.content)
                        print('Report downloaded successfully!')
                        return
                    
                    else:
                        print(f'Failed to download report: {file_response.status_code}')
                        return
                    
                # Export Fails    
                return
            
            
            
            elif status_response.status_code == 202:
                print('Export still in progress, waiting...')
                time.sleep(10)  # Wait for 10 seconds before checking again
           
           
            else:
                print(f'Failed to export report: {status_response.status_code}')
                break
    
    
    
    elif response.status_code == 429:
        retry_after = int(response.headers.get('Retry-After', 60))  # Default to 60 seconds if header is missing
        print(f'Too many requests. Retrying after {retry_after} seconds...')
        time.sleep(retry_after)
        export_report()  # Retry the export
    
    
    else:
        print(f'Failed to initiate export: {response.status_code}')

export_report()

 

 

 

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.