来自网络的数据 - DataSource.Error - 无法检索页面内容

问题描述 投票:0回答:1

我正在尝试从网页获取表格,但我似乎无法让 PowerBI 正确加载该页面。

网址是https://www.argentorshop.be/verkoop-uw-edelmetaal-aan-argentorshop/verkoop-uw-goudstaven-en-of-gouden-munten-aan-argentor/

我尝试导入的表是

GOLD KOERSEN
表,在此屏幕截图中以黄色突出显示。

但是,输入网址后,我得到了

随后

DataSource.Error

We were unable to retrieve the contents of the web page.

我已经尝试添加

HTTP request headers
Command timeout
但似乎没有任何效果。

我还尝试首先使用不同的(工作)网页,并修改

Source
步骤中的网址

Source = Web.BrowserContents("https://www.w3schools.com/html/html_tables.asp")

更改为

Source = Web.BrowserContents("https://www.argentorshop.be/verkoop-uw-edelmetaal-aan-argentorshop/verkoop-uw-goudstaven-en-of-gouden-munten-aan-argentor/")

但它会产生相同的错误。

此外,尝试使用

Selector
来等待
Web.BrowserContents(url,options)
options 中的特定
[WaitFor = [Selector = "#verkopen > div.bootstrap-table"]]
并不能解决问题。

有谁知道在 PowerBI 中正确导入该表的方法吗?

powerbi powerquery data-analysis powerbi-desktop m
1个回答
2
投票

试试这个。

let
    Source = Web.Contents(
    "http://www.argentorshop.be/nl/graphql",
    [
        Headers=[
            #"Method"="POST",
            #"Content-Type"="application/json"
        ],
        Content=Text.ToBinary("{""query"": ""{sellMetalsGrid (metals: [GOLD]){products {entity_id,name,purchasing_price,buying_premium,spread_percentage,spread_currency,selling_premium,price,image,short_description,product_type,fine_metal_content,metal,url,stock_status}}}""}")
    ]
    ),
    #"JSON" = Json.Document(Source),
    data = JSON[data],
    sellMetalsGrid = data[sellMetalsGrid],
    products = sellMetalsGrid[products],
    #"Converted to Table" = Table.FromList(products, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"entity_id", "name", "purchasing_price", "buying_premium", "spread_percentage", "spread_currency", "selling_premium", "price", "image", "short_description", "product_type", "fine_metal_content", "metal", "url", "stock_status"}, {"Column1.entity_id", "Column1.name", "Column1.purchasing_price", "Column1.buying_premium", "Column1.spread_percentage", "Column1.spread_currency", "Column1.selling_premium", "Column1.price", "Column1.image", "Column1.short_description", "Column1.product_type", "Column1.fine_metal_content", "Column1.metal", "Column1.url", "Column1.stock_status"})
in
    #"Expanded Column1"
© www.soinside.com 2019 - 2024. All rights reserved.