Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
cjmpetroleum
Frequent Visitor

Power query web connection get name from checkbox

I am looking to collect the information highlighted red in the code snippit below using PQ. The table imports just fine with the PQ code, but I can't figure out how to extract the highlighted text. Any ideas? Thanks!!!

 

TARGET CODE

<table class="table table-bordered table-hover1 table-responsive table-condensed">
<caption>
File Results
<a class="btn btn-primary btn-sm" href="/RequestAllSelectedFiles" title="Request Files">Request Files</a>
</caption>
<tbody><tr>
<th class="text-center">
Select
</th>
<th>
File Name
</th>
<th>
File Size
</th>
</tr>
<tr>
<td class="text-center">
<input type="checkbox" onchange="ToggleItemSelected(2878219);" id="CheckboxForFileNumber2878219" name="CheckboxForFileNumber2878219">
</td>
<td class="text-left">
03723592_1988-12-20_DI-SFL-LCL.tif
</td>
<td class="text-center">

<span title="approximately 48 Megabytes">~ 48 MB</span>


</td>
</tr>
<tr>
<td class="text-center">
<input type="checkbox" onchange="ToggleItemSelected(2878218);" id="CheckboxForFileNumber2878218" name="CheckboxForFileNumber2878218">
</td>
<td class="text-left">
03723592_1988-12-20_DI-SFL-LCL.pdf
</td>
<td class="text-center">

<span title="approximately 8 Megabytes">~ 8 MB</span>


</td>
</tr>
<tr>
<td class="text-center">
<input type="checkbox" onchange="ToggleItemSelected(2878217);" id="CheckboxForFileNumber2878217" name="CheckboxForFileNumber2878217">
</td>
<td class="text-left">
03723592_1988-12-20_DIRSV.pdf
</td>
<td class="text-center">

<span title="approximately 1 Megabytes">~ 1 MB</span>


</td>
</tr>

</tbody></table>

 

PQ CODE

let
Source = Web.BrowserContents(MY TARGET WEBSITE),
#"Extracted Table From Html" = Html.Table(Source, {

{"Column1", "TABLE.table.table-bordered.table-hover1.table-responsive.table-condensed > * > TR > :nth-child(1)"},

{"Column2", "TABLE.table.table-bordered.table-hover1.table-responsive.table-condensed > * > TR > :nth-child(2)"},

{"Column3", "TABLE.table.table-bordered.table-hover1.table-responsive.table-condensed > * > TR > :nth-child(3)"}}, [RowSelector="TABLE.table.table-bordered.table-hover1.table-responsive.table-condensed > * > TR"])

2 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

@cjmpetroleum 

 

Give this a go

 

let
    Source = Web.BrowserContents("https://www.myonlinetraininghub.com/test/example-table.html"),
    #"Converted to Table" = #table(1, {{Source}}),
    #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each let _list = List.Transform(Text.Split([Column1], "name="), each Text.Middle(_ , 1, Text.PositionOf(_, ">")-2))

in List.LastN(_list , List.Count(_list) -1)),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Column1"})
in
    #"Removed Columns"

 

PhilipTreacy_0-1732163723631.png

 

I've copied your <table> code and put it in a file on my site that can be loaded with this query.

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

Omid_Motamedise
Super User
Super User

Hi @cjmpetroleum 

Just use Text.Split as the below code

 

let
    Source = Web.BrowserContents("https://www.myonlinetraininghub.com/test/example-table.html"),
    Extract = List.Transform({0..30}, each Text.BetweenDelimiters(Source, "name=""",""">" ,_))
in
    Extract

View solution in original post

2 REPLIES 2
Omid_Motamedise
Super User
Super User

Hi @cjmpetroleum 

Just use Text.Split as the below code

 

let
    Source = Web.BrowserContents("https://www.myonlinetraininghub.com/test/example-table.html"),
    Extract = List.Transform({0..30}, each Text.BetweenDelimiters(Source, "name=""",""">" ,_))
in
    Extract
PhilipTreacy
Super User
Super User

@cjmpetroleum 

 

Give this a go

 

let
    Source = Web.BrowserContents("https://www.myonlinetraininghub.com/test/example-table.html"),
    #"Converted to Table" = #table(1, {{Source}}),
    #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each let _list = List.Transform(Text.Split([Column1], "name="), each Text.Middle(_ , 1, Text.PositionOf(_, ">")-2))

in List.LastN(_list , List.Count(_list) -1)),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Column1"})
in
    #"Removed Columns"

 

PhilipTreacy_0-1732163723631.png

 

I've copied your <table> code and put it in a file on my site that can be loaded with this query.

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.