I’m trying to fetch live sports data from RapidAPI using Excel VBA but I’m running into some issues. The API service doesn’t have direct VBA examples in their documentation which makes it tricky for me.
My goal is to get real-time cricket match data and display it in my Excel spreadsheet. I’ve been looking at their REST API documentation and found this sample code structure:
const apiSettings = {
method: 'GET',
endpoint: SERVICE_ENDPOINT,
headers: {
'Authorization': 'Bearer ' + TOKEN_KEY,
'Accept': 'application/json',
'User-Agent': 'MyApp/1.0'
},
params: {
league: 'cricket-live',
format: 'json'
}
};
fetch(apiSettings.endpoint, {
method: apiSettings.method,
headers: apiSettings.headers
})
.then(response => response.json())
.then(data => {
console.log('Match data:', data);
})
.catch(err => {
console.error('API Error:', err);
});
I’m wondering if there’s a way to make direct HTTP requests from VBA to get this JSON data, or maybe view the API response directly in a web browser first to understand the data structure better. Has anyone successfully connected RapidAPI services with Excel VBA before?