Forum

How do I add a colu...
 
Notifications
Clear all

How do I add a column showing Web Source?

5 Posts
2 Users
0 Reactions
78 Views
(@insadly)
Posts: 29
Trusted Member
Topic starter
 

Hi, I'm having a great time with both the PQ and PP course. But I've been stumped by an issue so simple I'm embarrassed to ask what has so far eluded me.

For practice I'm setting up a PQ for my son-in-law who is mad keen on horses. I'll be following Mynda's great YouTube on collecting data from multiple websites to download the 'form' on many different horses. The horse name is not shown in the data tables, but is in the Source URL. How do I add a column that on every line for each consecutive web page just puts in the source URL?

 

Here is an example: = Web.Page(Web.Contents("https://www.racingpost.com/profile/horse/865158/vocaliser/form")) - the horse's name is 'vocaliser', I can split that out once I have it in a column.

 

Many thanks if you can help,

 

Embarrassed from UKEmbarassed

 
Posted : 12/09/2021 1:53 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Simon,

No silly questions here 🙂

If you have created a table containing all the horse names, which in my example are the page start numbers that I had to build, but you would import from another table in Excel or a CSV file etc, then when you invoke the function you'll see the horse names should be in the first column of the query. In my example I remove this column in the last step, but you can just keep it there.

Hope that helps.

Mynda

 
Posted : 13/09/2021 8:25 pm
(@insadly)
Posts: 29
Trusted Member
Topic starter
 

Thanks Mynda, that was so helpful! But it took me a couple of hours to work through this issue:

The table I have of URLs is the entire URL. This did not work:

(PageStart as text)=>
let
Source = Web.Page(Web.Contents("&PageStart&")),

But if I just extracted the piece of the URL that is different in every web page, sorry the 'PageStart' variable was re-used as a variable name but now just refers to the nnnnnn/horse_name part of the URL:

(PageStart as text)=>
let
Source = Web.Page(Web.Contents("https://www.racingpost.com/profile/horse/"&PageStart&"/form")),

 

works fine. 

I bet I should have left out the two &s if i'm replacing the whole URL. I'll try it and see what happens.

 

Thanks again!Smile

 
Posted : 14/09/2021 4:41 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Simon,

If you just have a list of the URLs then it probably should be:

Source = Web.Page(Web.Contents(&"&PageStart&"&))

Mynda

 
Posted : 14/09/2021 7:35 pm
(@insadly)
Posts: 29
Trusted Member
Topic starter
 

Thanks Mynda, that's super-helpful. It has gone into my 'Excel Cheat-Sheet' (which is getting rather large!)

All the best,

Simon

 
Posted : 15/09/2021 10:31 am
Share: