Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I need to get a table from web page.
On that page there are javascript buttons switch th and td tag style to display:table-cell or display:none.
Every data is in the html but Power BI Desktop seems just ignore those display:none columns.
Is it possible to fetch those display:none cloumn?
Solved! Go to Solution.
Hey,
I'm sorry but the requirement for the element to be visible is hardcoded into the Web.Page function. Looking at the web page, it doesn't seem they have a way to select the first half or the second half of the table through URL input. So your only option left is to do some manual text processing. You can open the web page with Lines.FromBinary, instead of Web.Page
let Source = Table.FromColumns({Lines.FromBinary(Web.Contents("http://www.cpbl.com.tw/web/team_playergrade.php?&gameno=01&team=A02&year=2014&grade=1&syear=2014"))}), Headers = let #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Column1], "<th ")), #"Split Column by Delimiter" = Table.SplitColumn(#"Filtered Rows","Column1",Splitter.SplitTextByEachDelimiter({"</"}, QuoteStyle.Csv, false),{"Column1.1", "Column1.2"}), #"Split Column by Delimiter1" = Table.SplitColumn(#"Split Column by Delimiter","Column1.1",Splitter.SplitTextByEachDelimiter({">"}, QuoteStyle.Csv, true),{"Column1.1.1", "Column1.1.2"}), #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter1",{"Column1.1.1", "Column1.2"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Column1.1.2", "Value"}}), #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 0, 1) in #"Added Index", Values = let #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Column1], "<td align=""center""")), #"Split Column by Delimiter" = Table.SplitColumn(#"Filtered Rows","Column1",Splitter.SplitTextByEachDelimiter({"</"}, QuoteStyle.Csv, false),{"Column1.1", "Column1.2"}), #"Split Column by Delimiter1" = Table.SplitColumn(#"Split Column by Delimiter","Column1.1",Splitter.SplitTextByEachDelimiter({">"}, QuoteStyle.Csv, true),{"Column1.1.1", "Column1.1.2"}), #"Removed Columns1" = Table.RemoveColumns(#"Split Column by Delimiter1",{"Column1.1.1", "Column1.2"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns1",{{"Column1.1.2", "Value"}}), #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 0, 1), #"Calculated Modulo" = Table.TransformColumns(#"Added Index", {{"Index", each Number.Mod(_, Table.RowCount(Headers) ), type number}}), #"Added Index1" = Table.AddIndexColumn(#"Calculated Modulo", "Index.1", 0, 1e-6 + 1 / Table.RowCount(Headers)), #"Rounded Down" = Table.TransformColumns(#"Added Index1",{{"Index.1", Number.RoundDown, Int64.Type}}), #"Renamed Columns1" = Table.RenameColumns(#"Rounded Down",{{"Index.1", "RowNumber"}}) in #"Renamed Columns1", #"Appended Query" = Table.Combine({Headers, Values}), #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Appended Query", {{"Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Appended Query", {{"Index", type text}}, "en-US")[Index]), "Index", "Value"), #"Promoted Headers" = Table.PromoteHeaders(#"Pivoted Column") in #"Promoted Headers"
This should give you a refreshable query. From there you can select all columns and hit "Detect Type" to type them.
Note the pivot hack has a limitation...It's bounded by double arithmetic accuracy (the 1e-6 weight is added to count this), at some point (I'd imagine millions of rows into the document), you'll run into a jagged row 😕 But for your purpose, this method should be sufficient.
Regards,
PQ
Hi Theocritus,
can you post this web page? So I can try to help you to fix this problem.
Hey,
I'm sorry but the requirement for the element to be visible is hardcoded into the Web.Page function. Looking at the web page, it doesn't seem they have a way to select the first half or the second half of the table through URL input. So your only option left is to do some manual text processing. You can open the web page with Lines.FromBinary, instead of Web.Page
let Source = Table.FromColumns({Lines.FromBinary(Web.Contents("http://www.cpbl.com.tw/web/team_playergrade.php?&gameno=01&team=A02&year=2014&grade=1&syear=2014"))}), Headers = let #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Column1], "<th ")), #"Split Column by Delimiter" = Table.SplitColumn(#"Filtered Rows","Column1",Splitter.SplitTextByEachDelimiter({"</"}, QuoteStyle.Csv, false),{"Column1.1", "Column1.2"}), #"Split Column by Delimiter1" = Table.SplitColumn(#"Split Column by Delimiter","Column1.1",Splitter.SplitTextByEachDelimiter({">"}, QuoteStyle.Csv, true),{"Column1.1.1", "Column1.1.2"}), #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter1",{"Column1.1.1", "Column1.2"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Column1.1.2", "Value"}}), #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 0, 1) in #"Added Index", Values = let #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Column1], "<td align=""center""")), #"Split Column by Delimiter" = Table.SplitColumn(#"Filtered Rows","Column1",Splitter.SplitTextByEachDelimiter({"</"}, QuoteStyle.Csv, false),{"Column1.1", "Column1.2"}), #"Split Column by Delimiter1" = Table.SplitColumn(#"Split Column by Delimiter","Column1.1",Splitter.SplitTextByEachDelimiter({">"}, QuoteStyle.Csv, true),{"Column1.1.1", "Column1.1.2"}), #"Removed Columns1" = Table.RemoveColumns(#"Split Column by Delimiter1",{"Column1.1.1", "Column1.2"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns1",{{"Column1.1.2", "Value"}}), #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 0, 1), #"Calculated Modulo" = Table.TransformColumns(#"Added Index", {{"Index", each Number.Mod(_, Table.RowCount(Headers) ), type number}}), #"Added Index1" = Table.AddIndexColumn(#"Calculated Modulo", "Index.1", 0, 1e-6 + 1 / Table.RowCount(Headers)), #"Rounded Down" = Table.TransformColumns(#"Added Index1",{{"Index.1", Number.RoundDown, Int64.Type}}), #"Renamed Columns1" = Table.RenameColumns(#"Rounded Down",{{"Index.1", "RowNumber"}}) in #"Renamed Columns1", #"Appended Query" = Table.Combine({Headers, Values}), #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Appended Query", {{"Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Appended Query", {{"Index", type text}}, "en-US")[Index]), "Index", "Value"), #"Promoted Headers" = Table.PromoteHeaders(#"Pivoted Column") in #"Promoted Headers"
This should give you a refreshable query. From there you can select all columns and hit "Detect Type" to type them.
Note the pivot hack has a limitation...It's bounded by double arithmetic accuracy (the 1e-6 weight is added to count this), at some point (I'd imagine millions of rows into the document), you'll run into a jagged row 😕 But for your purpose, this method should be sufficient.
Regards,
PQ
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
55 | |
54 | |
37 | |
29 |
User | Count |
---|---|
78 | |
62 | |
45 | |
40 | |
40 |