Forum Discussion
Anonymous
3 years agoNot applicable
"Dataset includes a dynamic data source" Dynamic date in Web Source (No API)
I can't refresh dataset once it's been published because of this error. I cannot seem to find a workaround that suits my needs. The below example is grabbing a table from the web successfully in ...
PhilipTreacy
Super User
3 years agoAnonymous
Hard to say without seeing all of the code.
Phil
Anonymous
3 years agoNot applicable
Hi Phil,
This is the code grabbing the table directly from the webpage:
let
Source = Web.BrowserContents("https://www.example.com/data/type/date:2023-06-26"),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE.table.table-bordered.table-condensed.table-hover.table-fixed.pre-date-details-list > * > TR > :nth-child(1)"}, {"Column2", "TABLE.table.table-bordered.table-condensed.table-hover.table-fixed.pre-date-details-list > * > TR > :nth-child(2)"}, {"Column3", "TABLE.table.table-bordered.table-condensed.table-hover.table-fixed.pre-date-details-list > * > TR > :nth-child(3)"}}, [RowSelector="TABLE.table.table-bordered.table-condensed.table-hover.table-fixed.pre-date-details-list > * > TR"]),
#"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Datetime", type datetime}, {"Category", type text}, {"Release", type text}})
in
#"Changed Type"
Changes as per your recommendation:
let
Origen = Json.Document(
Web.Contents(
"https://www.example.com/data/type/date:",
[RelativePath=Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd")]
)
),
#"Extracted Table From Html" = Json.Document(Origen, {{"Column1", "TABLE.table.table-bordered.table-condensed.table-hover.table-fixed.pre-date-details-list > * > TR > :nth-child(1)"}, {"Column2", "TABLE.table.table-bordered.table-condensed.table-hover.table-fixed.pre-date-details-list > * > TR > :nth-child(2)"}, {"Column3", "TABLE.table.table-bordered.table-condensed.table-hover.table-fixed.pre-date-details-list > * > TR > :nth-child(3)"}}, [RowSelector="TABLE.table.table-bordered.table-condensed.table-hover.table-fixed.pre-date-details-list > * > TR"]),
#"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Datetime", type datetime}, {"Category", type text}, {"Release", type text}})
in
#"Changed Type"
This returns DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong or you might not have provided the right credentials to the server.