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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
icassiem
Helper V
Helper V

How to Refresh HTML file with Javascript embeded and result loaded as web source

Good day,

 

After several attempts of executting a specific javascript within PQ web.page

So i decided to save the HTML that contains the javascript that generates the signed certificate to a central location to be a web source within PBI. When clicking the html file the javascript executes and results to the web output, I would like to grab the output generated as a source value to be passed on

 

1. Html file as web source, but how do i get the web viewer text data in the preview to be loaded?

icassiem_0-1713464944050.png

 

2. Within pbi, how do i refresh the html file's JavaScript execution like F5 on browser so that new javascipt result is generated?

icassiem_1-1713465106629.png

Please Any Help?

Regards

3 REPLIES 3
v-yilong-msft
Community Support
Community Support

Hi @icassiem ,

For your first question, I think you can store the HTML to a file and then use a binary data type to store the file path. When loading the data into Power BI Desktop, you will get a column (named Column1) that lists the HTML file path, such as C:\Users\username\Desktop\filename.txt, and then, you can add a custom column in Query Editor mode that contains the following M code:

Custom column=Web.Page(File.Contents([Column1]))

 

For your second question, I think you can perform a refresh operation using the Power BI REST API. Use the Power BI service to authenticate and get an access token. Initiate a dataset refresh using the POST /refreshes endpoint. This triggers JavaScript execution in the HTML file. You can read the documentation below for more information: Enhanced refresh with the Power BI REST API - Power BI | Microsoft Learn and Solved: Re: Power bi javascript api data refresh - Microsoft Fabric Community

 

 

 

Best Regards

Yilong Zhou

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

Thank You @v-yilong-msft 

 

Point1

I have tried a few things and below i return an text result BUT not the expected text value, it completely differs from what the HTML is is displaying, the starting char are always "ey.." but this starts "W3sf.."

let Source = Web.Page(File.Contents("file:///C:/Temp/test2.html")),

// Source = Web.Page(Web.Contents("file:///C:/Temp/test2.html"))
// Source2 = Json.FromValue(Web.Contents(Source))
Source2 = Json.FromValue(Source),
// Source2 = Json.Document(Source),
Source3 = Binary.ToText(Source2)
in Source3

 

Point2

I have previously tried using PBI REST API that required app reg on Azure using the token but could never get it working for PBI Usage Matrix report, i have admin access to a test azure , do i need to register the api app again?

Kindly provide examples on how to ahcieve this and how to be used to refresh the HTML Javascript file please?

 

Regards

Hi,

Another lost cause, i just cant get this javascript S256 ssassign KUR to generate secret

 

The HTML Web Table does not work due to the resul being javascipt generated result and only works when Table in HTML Source

"Power Query does not recognize HTML tables with just one row"

"This method works only if the table is available in the page source and doesn't require JavaScript to render it."

 

Have run out of options, is there a way of using powershell/dataverse or something in PBI to help me refresh the javascript but is allowed a a data source refresh within PBI Service

?

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors