We’re about to take web querying to the next level. If you’re not familiar with web queries or if you missed our first discussion, you can brush up on Excel web query basics in Part 1 the Web Queries Series here (ha, that rhymes).
This will also make more sense if you’re familiar with the concepts of player IDs and website URLs discussed in this post.
The Weakness In Our First Query
You might recall that our first web query was specifically linked to Jose Fernandez’s player page at BrooksBaseball.net. This is a great way to pull his specific pitch mix into an Excel file. But it’s also pretty limiting that we can only pull in Jose Fernandez’s statistics and would have to create a new query to look up another player. At that point it’s faster to just go to BrooksBaseball.net and start searching for players manually.
What is a Dynamic Web Query?
A dynamic query would be designed in such a way so that we only have to initially set up one query. That query is not static, linked to one specific page or player, it’s dynamic, meaning it is linked to an input that can change.
Said another way, instead of linking the web query to player ID “11530“, link the web query to a specific cell in Excel. Then whatever player ID is typed into that cell will be used in the web query.
A New Example
Instead of linking to BrooksBaseball.net, we’ll link to the player pages at Razzball.com. If you haven’t checked them out, these player pages over are an incredible resource. Take a look at Miguel Cabrera’s page using this link:
And just to illustrate something about the URLs at Razzball, try this link:
They load to the same page. The player’s name is not necessary for the page to load.
Stop Blabbering And Asking Me To Read Things. Show Me How To Do This.
Sorry about that. Video is more conducive to understanding this dynamic web query example. Here you go:
Have Any Questions?
Don’t just watch the video. Give this a try. You could use this to more easily do projections, evaluate trades, set the ideal daily fantasy lineup, and much more.
If you like getting your hands dirty in Excel and doing player analysis like this, sign up for the Smart Fantasy Baseball newsletter where you’ll get more great ideas like this.