Forum Discussion

woolf's avatar
woolf
Frequent Visitor
1 year ago

Web.BrowserContents - Expression.Error: We cannot convert the value type "Table" to type "Text"

Hi, 

 

I tried to use the steps from the youtube example link. With the direct link it works, but change it from direct link to the table I get the error Expression.Error: We cannot convert the value type "Table" to type "Text". 

Code: 

 

 

let
    Quelle = Web.BrowserContents(URLs),
    #"Aus HTML-Code extrahierte Tabelle" = Html.Table(Quelle, {
{"Bez.", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(1)"},
{"2026e", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(2)"},
{"2025e", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(3)"},
{"2024e", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(4)"},
{"2023", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(5)"},
{"2022", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(6)"},
{"2021", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(7)"},
{"2020", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(8)"},
{"2019", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(9)"},
{"2018", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(10)"},
{"2017", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(11)"},
{"2016", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(12)"},
{"2015", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(13)"},
{"2014", "DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR > :nth-child(14)"}},
[RowSelector="DIV.ov-carousel.ov-carousel\-\-table-fixed-cells.ov-snapshot-fundamental-1.outer-spacing\-\-large-top > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE.table.ov-table.ov-table\-\-fixed-x-cells.outer-spacing\-\-none-top.text-size\-\-small > * > TR"]),
    #"Höher gestufte Header" = Table.PromoteHeaders(#"Aus HTML-Code extrahierte Tabelle", [PromoteAllScalars=true])
in
    #"Höher gestufte Header"

 

 

Thx in advance.

 

./Florian

3 Replies

  • Hi woolf - The error "Expression.Error: We cannot convert the value type 'Table' to type 'Text'" usually occurs in Power Query when you try to use a table as if it were a text value. 

     

    try the below example:

    let
    Quelle = Web.BrowserContents("https://example.com"),
    ExtractedTable = Html.Table(Quelle, {
    {"Bez.", "DIV.ov-carousel > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE > * > TR > :nth-child(1)"},
    {"2026e", "DIV.ov-carousel > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE > * > TR > :nth-child(2)"}
    }, [RowSelector="DIV.ov-carousel > DIV.ov-carousel__wrapper > DIV.ov-carousel__inner > TABLE > * > TR"]),
    ConvertedToText = Table.TransformColumnTypes(ExtractedTable,{{"Bez.", type text}, {"2026e", type text}})
    in
    ConvertedToText

     

    Replace https://example.com with your actual URL and adjust the HTML selectors as necessary. This should help resolve issues related to data type conversion and HTML extraction complexities.

     

     

    • woolf's avatar
      woolf
      Frequent Visitor

      Unfortunately it didn't solve my problem to go automaticlly through all the links in the table and provide me all datas for the links ☹️

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    Thanks for the solution rajendraongole1  offered and i want to offer some more information for user to refer to.

    hello woolf , based on your description, based on the error information, please check the #"Aus HTML-Code extrahierte Tabelle" step, you can refer to the following similar thread. 

    ssbipolar.com

    Solved: "Cannot convert a value of type Table to type Text... - Microsoft Fabric Community

     

    Best Regards!

    Yolo Zhu

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