Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am using a Python Notebook to export Paginated Reports to an HTML file. Now it works fine for CSV files, I get clear and readable CSV back, the same goes for IMAGE with the format set to PNG. But when I set the format to MHTML as per the documentation I am getting a long error response about my headers, followed by a succesfull download of a file with .html extension. If I open it however it doesn't look like HTML:
VEg9IjAiIEhFSUdIVD0iMTAwJSI+PC9URD48L1RSPjwvVEFCTEU+PC9ESVY+PC9ESVY+PC9ib2R5
PjwvaHRtbD4=
------=_NextPart_01C35DB7.4B204430--
I have tried several bodies, but the documentation is lacking for the formatSettings for Paginated Reports:
And with empty formatSettings and I also left the formatSettings completely out, but there is no difference. The response from the download action for this html file is as follows:
Failed to parse headers (url=https://api.powerbi.com:443/v1.0/myorg/groups/[REDACTED]/reports/[REDACTED]/exports/Mi9CbG9iSWRWMi1m...😞 [NoBoundaryInMultipartDefect()], unparsed data: '' Traceback (most recent call last): File "/home/trusted-service-user/cluster-env/trident_env/lib/python3.11/site-packages/urllib3/connection.py", line 464, in getresponse assert_header_parsing(httplib_response.msg) File "/home/trusted-service-user/cluster-env/trident_env/lib/python3.11/site-packages/urllib3/util/response.py", line 88, in assert_header_parsing raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data) urllib3.exceptions.HeaderParsingError: [NoBoundaryInMultipartDefect()], unparsed data: ''
And the file itself remains unreadable base64 encoded and it seems to be partial. Now I have a hunch that there maybe is a formatSetting to get a UTF-8 / UTF-16 HTML file, but it also seems odd that that would have to be specified. How can I find out why my HTML file is not properly formatted as readable (and usable) HTML?
Adding just ?rdl:format=MHTML to a URL of a Paginated Report returns a readable HTML file. But when using the REST API, I cannot find why it keeps sending me base64 encoded partial files.
Thanks for helping me out
Martijn Kuiper
Solved! Go to Solution.
Ok, plan B. Use Power Query to decode the Base64 data. Text.FromBinary(Binary.FromText(payload),Encoding.Base64)
@martijnkuiper, As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?
@lbendlin , Thanks for your promt response
Thanks,
Prashanth Are
MS Fabric community support
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query
in your call try to add an
accept = "text/html"
directive in the header, not the body.
Unfortunately this has had no effect for me. Adding the Accept text/html didn't change anything for me. I then switched it up, following your documentation, to */*:
But this also didn't lead to a different outcome
Ok, plan B. Use Power Query to decode the Base64 data. Text.FromBinary(Binary.FromText(payload),Encoding.Base64)
I in stead used Python base64 library (since moving in PowerQuery within my script would be quite some redesign) and I now get the same HTML content as I am getting when I export the paginated report to HTML from the browser view.
I can't imagine this is working as intended, but I at least now have an HTML file!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
53 | |
32 | |
27 | |
26 | |
26 |
User | Count |
---|---|
62 | |
49 | |
30 | |
24 | |
23 |