Macro to Combine two HTML files into one

Caporegime
Joined
28 Feb 2004
Posts
74,822
Hi all,

Sorry complete newbie here with any kind of advanced programming, so please be kind :)

The problem I have is that I would like to automate (by way of macro or somesuch) the combination of two separate medal tables into one combined medal table.

If you look here

http://www.eastswimming.org/swimresults/2017/LC Champs Weekend Two/index2.htm

On the right hand side, under services, is a sub menu for "Medal Tables".

Click into that and we have the Norwich table and the Luton Table Carried over.

Underneath which is a combined medal table which I had to manually create by adding together the medals the clubs had gained at each meet, and then create a table and fill out the table manually with the combined scores.

as you can imagine it took a while.

I would love to be able to automate that process by use of a macro maybe (if that is possible) where I can import the two original tables into word or excel possibly, and it would then combine the two and produce one final table.

But I do not know even where to start, hence coming here to see if anyone with far more skill and knowledge than me could help some please.

If you could point me in the right direction any help would be much appreciated.

Thank you in advance.
 
Ideally you should be looking into storing these in a database (MYSQL is a free example) and then it would be trivial to select, combine and sort these. If you create a little form / admin system, it'll also be pretty easy to CReate, Update and Delete them too.

Not quite the answer you were probably looking for, but the time and effort you'd put in to creating macros in excel, you may as well do it the web friendly way :)
 
That then produces the problem of getting someone to rewrite the software that generates the medal tables and the rest of the website to put them in to a database format.

The original software is nothing to do with me and I cannot adjust it or rewrite it.
 
You could use a python script to scrape the data from the existing tables into a database, then just create a web front end to show the results. You could then copy and paste that html into the existing website as you've done with that one.

I suppose it depends if you want the data to be live, as in updates constantly or you're doing it at a set time each week/month

Is it just the 2 tables in total you want to combine, or is there going to be more?
 
Last edited:
Another solution using Excel.

Create 3 tabs (total, luton, norwich)

For luton and norwich, click on DATA > FROM WEB and then select the corresponding webpage and pull the table into excel

Then in the total sheet, it's a case of looking up each location from the other 2 sheets and adding the medals together.

I've not got any time to look at it now but if I get some later I will.
 
You could use a python script to scrape the data from the existing tables into a database, then just create a web front end to show the results. You could then copy and paste that html into the existing website as you've done with that one.

I suppose it depends if you want the data to be live, as in updates constantly or you're doing it at a set time each week/month

Is it just the 2 tables in total you want to combine, or is there going to be more?

Just those two to combine and it would be at the end of each day.
 
I've knocked up a quick spreadsheet which will hopefully get you on the way to what you're looking for.

I capture both medal tables (Norwich and Luton tabs) on sheet startup and update.

The total tab is just a set of vlookups that essentially add the two sheets together. The vlookups rely on the team names being the same in both sheets, so you may need to construct one or two exceptions if the names don't exactly match.

www.watermeloncake.co.uk/medalTable.xlsx

Hope this helps!
 
Back
Top Bottom