Forum Discussion

Shiroyasha1's avatar
Shiroyasha1
New Member
1 year ago
Solved

Export PBIT from PBIX in bulk automated using Python or Powershell

Hi,   Is there a way I could convert a pbix file to pbit through code? Say I have hundreds or thousands of files. I would like to extract the json (DataModelSchema) file of each pbix which I have ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Shiroyasha1 ,

    Thank you for reaching out and sharing the links in your conformation query. Unfortunately, I am unable to access external links. However, I do have detailed information regarding the topic you're asking about.

    As discussed, the Power BI API doesn't support PBIX to PBIT conversion. You could try Power Automate for exporting reports, but it only works with Power BI Service-hosted reports, not local PBIX files.

    You’ve used pyautogui to automate the "Save As" process for exporting PBIX to PBIT, which works but isn’t ideal for large batches.

    You mentioned that you can access the Power BI REST API but only see SSRS reports, not Power BI reports. This indicates that your current access may be pointing to the SSRS reports endpoint rather than Power BI reports.

    The endpoint GET https://api.powerbi.com/v1.0/myorg/reports/{reportId}/Export exports Power BI report contents (e.g., PDF, PPTX), not the PBIX file. To work with Power BI reports, use the correct API endpoints for Power BI reports (not SSRS reports).

     

    To list Power BI reports in your workspace, use:

    GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports

    This will return a list of reports (not SSRS) in the specified workspace.

    The endpoint you found exports a Power BI report (not PBIX). After retrieving the report, use the export endpoint to trigger the export.

    GET https://api.powerbi.com/v1.0/myorg/reports/{reportId}/Export

    Ensure you're querying the correct workspace by using the right groupId. You may need to list your organization’s workspaces to confirm it. There’s no API to download PBIX files from the Power BI Service. The API only exports report contents (e.g., PDF, PPTX), not the PBIX file.

     

    For more information refer to below link:

    Reports - REST API (Power BI Power BI REST APIs) | Microsoft Learn

    Reports - Export Report In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

    Reports - Export To File - REST API (Power BI Power BI REST APIs) | Microsoft Learn

     

    I hope this helps! If you have any more questions or need further assistance, feel free to let me know.

     

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

     

    Thankyou