A macro to Download form data from webpage (Just learning about Excel at 61)

HectorIN2Excell

New Member
Joined
May 7, 2023
Messages
8
Office Version
  1. 2007
Platform
  1. Windows
I am trying to download webpage data from the link below and can do it to a certain standard but the data gets jumbled at times and isn't consistent
using procedures within excel.
Greyhound Bet | Greyhound Betting Web App from the Racing Post

So I would like to have my own macro that collects data from each race for 6 greyhounds.
with the data from each heading below in a table.

DateTrackDisTrpSplitBendsFinByWin/SecRemarksWnTmGngWghtSPGradeCalTm

The end product I would appreciate is to have the : The greyhound name, The data under each heading, Each race downloaded onto separate sheets, Race 1 on sheet1 upto last Race 12 on sheet 12. This is repeated for which ever greyhound track meeting I run at it on. (Tracks are like Romford, Crayford, Towcester, etc)
I am a oldie whois a newbie at this so I would really appreciate some of your wisdom and knowhow on this matter.

Thanks in advance
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi

Can I just ask, how are you currently downloading this data. You said you are already doing it to a certian standard.
 
Upvote 0
Hi

Can I just ask, how are you currently downloading this data. You said you are already doing it to a certian standard.
Hi SQUIDD I have used from the data _ From Web_ then New Query procedure but couldn't get the process that I would like.
I also used instant data scraper from google app again giving me similar results. So I would appreciate my own macro so I can download the data so I can then use excel to work out my own formulas. Any help would be much appreciated.
 
Upvote 0
Hi SQUIDD I have used from the data _ From Web_ then New Query procedure but couldn't get the process that I would like.
I also used instant data scraper from google app again giving me similar results. So I would appreciate my own macro so I can download the data so I can then use excel to work out my own formulas. Any help would be much appreciated.
You can use Power Query in Excel to get data from this url: https://greyhoundbet.racingpost.com...e=2023-05-10&view=meetings&blocks=header,list
 
Upvote 0
Hi Again

I could point you in the direction i have done this before.

It involves using selinium basic and chrome driver.

Let me know if this is a route you would like to explore.

i started using this when IE was phased out.

Dave
 
Upvote 0
Hi Again

I could point you in the direction i have done this before.

It involves using selinium basic and chrome driver.

Let me know if this is a route you would like to explore.

i started using this when IE was phased out.

Dave
Hi Dave,
It sounds like a good place to start for me and I am definitely willing to explore this way.
So I would appreciate your assistance with this.
Thanks Hector
 
Upvote 0
I appreciate your feedback but I am using excel 2007 and its not available that's why I was hoping for vba code. Thanks
Oh, I see. I suggest writing a VBA macro which:
  • Makes a HTTP request to https://greyhoundbet.racingpost.com/meeting/blocks.sd?r_date=<date>&view=meetings&blocks=header%2Clist to retrieve data in JSON format. where <date> is the date of data in "yyyy-mm-dd" format that you desire to retrieve.
  • Then, you can this VBA-JSON module to parse the data in JSON format that you retrieved from step 1 above.
Here is an example of a JSON format:
JSON:
{
    "list": {
        "items": [
            {
                "track_id": "70",
                "track": "Central Park",
                "meeting_abandoned": 0,
                "tv_id": "",
                "tv_name": "",
                "title": "Graded Races",
                "tvShortName": "BAGS",
                "firstRace": "2023-05-12 11:43",
                "lastRace": "2023-05-12 13:59",
                "isSkyTv": "",
                "isGreyhoundTv": "",
                "isTurfTv": "",
                "isAtTheRacesTv": "",
                "isBAGS": "1",
                "isSIS": "",
                "isNonBagsSis": "",
                "isProvincial": "",
                "isIrish": "",
                "isNonBetting": "",
                "allCardsFinal": "1",
                "bestBet": {
                    "dogName": "Drumkeeran Ted",
                    "dogTrap": "6",
                    "starsQty": "5",
                    "raceDate": "11:43"
                },
                "nextBestBet": {
                    "dogName": "Fearmore Christy",
                    "dogTrap": "6",
                    "starsQty": "5",
                    "raceDate": "1:13"
                },
                "races": [
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978138",
                        "raceDate": "2023-05-12 11:43",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 1",
                        "distance": "265m",
                        "raceGrade": "D3",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "6",
                        "dogId": "556382",
                        "dogName": "Drumkeeran Ted",
                        "selectionStrength": "5",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D3)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978139",
                        "raceDate": "2023-05-12 11:58",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 2",
                        "distance": "265m",
                        "raceGrade": "D4",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "2",
                        "dogId": "565105",
                        "dogName": "Burnpark Patsy",
                        "selectionStrength": "2",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D4)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978140",
                        "raceDate": "2023-05-12 12:13",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 3",
                        "distance": "265m",
                        "raceGrade": "D2",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 130,
                        "bestBet": "",
                        "dogTrap": "4",
                        "dogId": "559133",
                        "dogName": "Kilwest Henry",
                        "selectionStrength": "2",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D2)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978141",
                        "raceDate": "2023-05-12 12:28",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 4",
                        "distance": "480m",
                        "raceGrade": "A7",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 130,
                        "bestBet": "",
                        "dogTrap": "3",
                        "dogId": "568279",
                        "dogName": "Call You Mine",
                        "selectionStrength": "5",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (A7)",
                        "distanceTitle": "480m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978142",
                        "raceDate": "2023-05-12 12:43",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 5",
                        "distance": "265m",
                        "raceGrade": "D4",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "4",
                        "dogId": "541871",
                        "dogName": "Hollyoak Dexter",
                        "selectionStrength": "1",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D4)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978143",
                        "raceDate": "2023-05-12 12:58",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 6",
                        "distance": "480m",
                        "raceGrade": "A5",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 140,
                        "bestBet": "",
                        "dogTrap": "5",
                        "dogId": "567090",
                        "dogName": "Bandit Murphi",
                        "selectionStrength": "1",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (A5)",
                        "distanceTitle": "480m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978144",
                        "raceDate": "2023-05-12 13:13",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 7",
                        "distance": "265m",
                        "raceGrade": "D3",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "6",
                        "dogId": "563351",
                        "dogName": "Fearmore Christy",
                        "selectionStrength": "5",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D3)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978145",
                        "raceDate": "2023-05-12 13:28",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 8",
                        "distance": "480m",
                        "raceGrade": "A4",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 145,
                        "bestBet": "",
                        "dogTrap": "2",
                        "dogId": "558681",
                        "dogName": "Cromac Chick",
                        "selectionStrength": "1",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (A4)",
                        "distanceTitle": "480m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978146",
                        "raceDate": "2023-05-12 13:44",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 9",
                        "distance": "265m",
                        "raceGrade": "D5",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "3",
                        "dogId": "573016",
                        "dogName": "Do It Rocket",
                        "selectionStrength": "2",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D5)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978147",
                        "raceDate": "2023-05-12 13:59",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 10",
                        "distance": "480m",
                        "raceGrade": "HP",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 155,
                        "bestBet": "",
                        "dogTrap": "4",
                        "dogId": "564421",
                        "dogName": "Marinas Diva",
                        "selectionStrength": "3",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (HP)",
                        "distanceTitle": "480m"
                    }
                ],
                "racesCount": 10
            }
        ],
        "isBAGS": "1",
        "isSIS": "1",
        "isNonBagsSis": "1",
        "isProvincial": "1",
        "isIrish": "1",
        "isSkyTv": "",
        "isGreyhoundTv": "1",
        "isTurfTv": "",
        "isAtTheRacesTv": "",
        "meetingsAvailable": 1,
        "next_race": {
            "race_id": "1977946",
            "r_date": "2023-05-12"
        }
    },
    "header": [
        {
            "day": "2023-05-12",
            "racesAvailable": true
        },
        {
            "day": "2023-05-13",
            "racesAvailable": true
        },
        {
            "day": "2023-05-14",
            "racesAvailable": true
        },
        {
            "day": "2023-05-15",
            "racesAvailable": true
        },
        {
            "day": "2023-05-16",
            "racesAvailable": true
        },
        {
            "day": "2023-05-17",
            "racesAvailable": false
        },
        {
            "day": "2023-05-18",
            "racesAvailable": false
        }
    ]
}
 
Upvote 0
Oh, I see. I suggest writing a VBA macro which:
  • Makes a HTTP request to https://greyhoundbet.racingpost.com/meeting/blocks.sd?r_date=<date>&view=meetings&blocks=header%2Clist to retrieve data in JSON format. where <date> is the date of data in "yyyy-mm-dd" format that you desire to retrieve.
  • Then, you can this VBA-JSON module to parse the data in JSON format that you retrieved from step 1 above.
Here is an example of a JSON format:
JSON:
{
    "list": {
        "items": [
            {
                "track_id": "70",
                "track": "Central Park",
                "meeting_abandoned": 0,
                "tv_id": "",
                "tv_name": "",
                "title": "Graded Races",
                "tvShortName": "BAGS",
                "firstRace": "2023-05-12 11:43",
                "lastRace": "2023-05-12 13:59",
                "isSkyTv": "",
                "isGreyhoundTv": "",
                "isTurfTv": "",
                "isAtTheRacesTv": "",
                "isBAGS": "1",
                "isSIS": "",
                "isNonBagsSis": "",
                "isProvincial": "",
                "isIrish": "",
                "isNonBetting": "",
                "allCardsFinal": "1",
                "bestBet": {
                    "dogName": "Drumkeeran Ted",
                    "dogTrap": "6",
                    "starsQty": "5",
                    "raceDate": "11:43"
                },
                "nextBestBet": {
                    "dogName": "Fearmore Christy",
                    "dogTrap": "6",
                    "starsQty": "5",
                    "raceDate": "1:13"
                },
                "races": [
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978138",
                        "raceDate": "2023-05-12 11:43",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 1",
                        "distance": "265m",
                        "raceGrade": "D3",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "6",
                        "dogId": "556382",
                        "dogName": "Drumkeeran Ted",
                        "selectionStrength": "5",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D3)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978139",
                        "raceDate": "2023-05-12 11:58",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 2",
                        "distance": "265m",
                        "raceGrade": "D4",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "2",
                        "dogId": "565105",
                        "dogName": "Burnpark Patsy",
                        "selectionStrength": "2",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D4)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978140",
                        "raceDate": "2023-05-12 12:13",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 3",
                        "distance": "265m",
                        "raceGrade": "D2",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 130,
                        "bestBet": "",
                        "dogTrap": "4",
                        "dogId": "559133",
                        "dogName": "Kilwest Henry",
                        "selectionStrength": "2",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D2)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978141",
                        "raceDate": "2023-05-12 12:28",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 4",
                        "distance": "480m",
                        "raceGrade": "A7",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 130,
                        "bestBet": "",
                        "dogTrap": "3",
                        "dogId": "568279",
                        "dogName": "Call You Mine",
                        "selectionStrength": "5",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (A7)",
                        "distanceTitle": "480m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978142",
                        "raceDate": "2023-05-12 12:43",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 5",
                        "distance": "265m",
                        "raceGrade": "D4",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "4",
                        "dogId": "541871",
                        "dogName": "Hollyoak Dexter",
                        "selectionStrength": "1",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D4)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978143",
                        "raceDate": "2023-05-12 12:58",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 6",
                        "distance": "480m",
                        "raceGrade": "A5",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 140,
                        "bestBet": "",
                        "dogTrap": "5",
                        "dogId": "567090",
                        "dogName": "Bandit Murphi",
                        "selectionStrength": "1",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (A5)",
                        "distanceTitle": "480m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978144",
                        "raceDate": "2023-05-12 13:13",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 7",
                        "distance": "265m",
                        "raceGrade": "D3",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "6",
                        "dogId": "563351",
                        "dogName": "Fearmore Christy",
                        "selectionStrength": "5",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D3)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978145",
                        "raceDate": "2023-05-12 13:28",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 8",
                        "distance": "480m",
                        "raceGrade": "A4",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 145,
                        "bestBet": "",
                        "dogTrap": "2",
                        "dogId": "558681",
                        "dogName": "Cromac Chick",
                        "selectionStrength": "1",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (A4)",
                        "distanceTitle": "480m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978146",
                        "raceDate": "2023-05-12 13:44",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 9",
                        "distance": "265m",
                        "raceGrade": "D5",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 105,
                        "bestBet": "",
                        "dogTrap": "3",
                        "dogId": "573016",
                        "dogName": "Do It Rocket",
                        "selectionStrength": "2",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (D5)",
                        "distanceTitle": "265m"
                    },
                    {
                        "trackId": "70",
                        "trackShortName": "",
                        "trackName": "CENTRAL PARK",
                        "trackCde": "",
                        "raceId": "1978147",
                        "raceDate": "2023-05-12 13:59",
                        "sortBagsCde": "99",
                        "showMeeting": "N",
                        "actBagsCde": "B",
                        "raceStatus": "O",
                        "raceTitle": "Race 10",
                        "distance": "480m",
                        "raceGrade": "HP",
                        "country": "GB",
                        "raceType": "F",
                        "raceStartedDatetime": "",
                        "tvId": "",
                        "tvName": "",
                        "prizeSterling": 155,
                        "bestBet": "",
                        "dogTrap": "4",
                        "dogId": "564421",
                        "dogName": "Marinas Diva",
                        "selectionStrength": "3",
                        "clipId": "",
                        "starsQty": "",
                        "gradeTitle": "Grade: (HP)",
                        "distanceTitle": "480m"
                    }
                ],
                "racesCount": 10
            }
        ],
        "isBAGS": "1",
        "isSIS": "1",
        "isNonBagsSis": "1",
        "isProvincial": "1",
        "isIrish": "1",
        "isSkyTv": "",
        "isGreyhoundTv": "1",
        "isTurfTv": "",
        "isAtTheRacesTv": "",
        "meetingsAvailable": 1,
        "next_race": {
            "race_id": "1977946",
            "r_date": "2023-05-12"
        }
    },
    "header": [
        {
            "day": "2023-05-12",
            "racesAvailable": true
        },
        {
            "day": "2023-05-13",
            "racesAvailable": true
        },
        {
            "day": "2023-05-14",
            "racesAvailable": true
        },
        {
            "day": "2023-05-15",
            "racesAvailable": true
        },
        {
            "day": "2023-05-16",
            "racesAvailable": true
        },
        {
            "day": "2023-05-17",
            "racesAvailable": false
        },
        {
            "day": "2023-05-18",
            "racesAvailable": false
        }
    ]
}
Thank You Squid
This looks like it works for you but you have to understand I am completely new to this process
and I have tried making it work for me and I am doing something wrong. Please can you give me a breakdown of how and what to fill in after the date.
I apologise for my lack of knowledge with Json but I will read up on it. I just need to get the data out first. Thank you for your help.
 
Upvote 0
Thank You Squid
This looks like it works for you but you have to understand I am completely new to this process
and I have tried making it work for me and I am doing something wrong. Please can you give me a breakdown of how and what to fill in after the date.
I apologise for my lack of knowledge with Json but I will read up on it. I just need to get the data out first. Thank you for your help.
Try this macro and see if it works for you.
Code:
Private Sub GetTrackInfo()
    Dim objWinHttp As Object
    Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
    With objWinHttp
        .Open "GET", "https://greyhoundbet.racingpost.com/meeting/blocks.sd?r_date=" & Format(Date, "yyyy-mm-dd") & "&view=meetings&blocks=header%2Clist", True
        .SetRequestHeader "Accept", "application/json"
        .SetRequestHeader "Accept-Language", "en-US,en;q=0.9"
        .Send
        .WaitForResponse
        If .Status = 200 Then
            Dim i As Long, j As Long
            Dim strResponseText As String
            strResponseText = StrConv(.ResponseBody, vbUnicode)
            Dim objJson As Scripting.Dictionary
            Set objJson = JsonConverter.ParseJson(strResponseText)
            With objJson
                If objJson.Exists("list") Then
                    If objJson.Item("list").Exists("items") Then
                        If objJson.Item("list")("items").Count > 0 Then
                            For i = 1 To objJson.Item("list")("items").Count
                                Debug.Print "Track: " & objJson.Item("list")("items")(i)("track")
                                Debug.Print "Track id: " & objJson.Item("list")("items")(i)("track_id")
                                Debug.Print "Title: " & objJson.Item("list")("items")(i)("title")
                                Debug.Print "First race: " & objJson.Item("list")("items")(i)("firstRace")
                                Debug.Print "Last race: " & objJson.Item("list")("items")(i)("lastRace")
                                If objJson.Item("list")("items")(i).Exists("races") Then
                                    For j = 1 To objJson.Item("list")("items")(i)("races").Count
                                        Debug.Print "Race Id: " & objJson.Item("list")("items")(i)("races")(j)("raceId")
                                        Debug.Print "Race date: " & objJson.Item("list")("items")(i)("races")(j)("raceDate")
                                        Debug.Print "Race status: " & objJson.Item("list")("items")(i)("races")(j)("raceStatus")
                                        Debug.Print "Race title: " & objJson.Item("list")("items")(i)("races")(j)("raceTitle")
                                        Debug.Print "Dog name: " & objJson.Item("list")("items")(i)("races")(j)("dogName")
                                    Next j
                                End If
                            Next i
                        End If
                    End If
                End If
            End With
        End If
    End With
End Sub
 
Upvote 1

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top