Forum Discussion
Replace Web.BrowserContents with Web.Contents
- 4 years ago
Hi v-jingzhang ,
Thank you for taking a look at my issue.
I understand that there is a way around this problem by using a gateway but I work in an environment that does not provide me with one nor allows me to install one.
Please note that I reposted this issue because the first one was marked as spam. The spam categorization has been removed and @KNP has provided a solution that does not involve a gateway. The solution can be found here: Solved: Replace Web.BrowserContents with Web.Contents - Microsoft Power BI Community
Thanks,
Myriam
Hi myriamouan
It seems the behavior in Power BI Service has changed. I create a table with below code and publish it to the Service. When I refresh the dataset manually and set up a scheduled refresh for it, both succeed. I select Anonymous for Authentication method and Organizational for Privay level. You may have a try.
let
Source = Web.BrowserContents("https://ir.tevapharm.com/news-and-events/press-releases/default.aspx"),
#"Extracted Table From Html" =
Html.Table(
Source,
{
{"URL","a[href^=""/news-""]", each [Attributes][href]},
{"Headline", ".module-news .module_headline"},
{"Date", ".module-news .module_date-time"}
},
[RowSelector=".module-news .module_item-wrap"]
),
#"Replaced Value" = Table.ReplaceValue(#"Extracted Table From Html","/news-","https://ir.tevapharm.com/news-",Replacer.ReplaceText,{"URL"}),
#"Changed Type" = Table.TransformColumnTypes(#"Replaced Value",{{"URL", type text}, {"Headline", type text}, {"Date", type date}})
in #"Changed Type"
If it still fails, a common workaround is to use an on-premises data gateway. See Troubleshooting the Power Query Web connector | Microsoft Docs
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.