Forum Discussion
Website Power query connection
Hello everyone,
I have a challenges where I want to import data from a website using Power Query for daily refreshing (data refreshes every day at 1pm). Although, when I try to connect to it, the interface in POwer Query doesn't show it as a suggested table, neither can it be seen in web view. Do you have any idea how to actually get the table in Excel (without daily copying and pasting?
Here is the link to the website. Data, I want to import, is in a table called Tabular data.
https://www.bsp-southpool.com/day-ahead-trading-results-si.html
Thank you for your response already in advance.
Marko
3 Replies
What I can see power query do suggest you a table name Tabular Data, may I know what version of excel are you using. however below is the M code
let Source = Web.BrowserContents("https://www.bsp-southpool.com/day-ahead-trading-results-si.html"), #"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE:nth-child(2) > * > TR > :nth-child(1)"}, {"Column2", "TABLE:nth-child(2) > * > TR > :nth-child(2)"}, {"Column3", "TABLE:nth-child(2) > * > TR > :nth-child(3)"}}, [RowSelector="TABLE:nth-child(2) > * > TR"]), #"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]) in #"Promoted Headers"
If this resolves your query don't forget Mark as Solution.
- mkuznerCopper Contributor
I can see the suggested table Tabular data (using Microsoft 365 btw.), but the problem is that when I load it, it appears as an empty table. And if you visit the actual website, it is not empty at all, but filled with 24-hour data, and that is the actual data I am trying to import to Excel spreadsheet.
- SergeiBaklanDiamond Contributor
Afraid Power Query won't help. Body of the table is not in HTML directly, thus nothing to parse. If to check html body is generated by some function. That's all what Power Query see:
<h2> Tabular data </h2> <table> <thead><tr> <th scope="col" class="first"> Hour </th> <th scope="col"> Volume </th> <th scope="col" class="last"> Price </th> </tr></thead> <tbody id="results-table-da-tbody"></tbody> </table> <script>document.addEventListener('DOMContentLoaded',function(event) { if(!BSPCharts.table.da.INITIALIZED) { BSPCharts.table.da.hDate=document.getElementById('auction-chart-date'); BSPCharts.table.da.hTableBody=document.getElementById('results-table-da-tbody'); setTimeout(function(){BSPCharts.table.da.init()},1500) } } )</script>