How to Pull Projected Starting Pitcher Information into Your Daily Fantasy Baseball Spreadsheet

In this post I’m going to address two common questions I get about creating daily fantasy baseball spreadsheets:

  1. Where and how can I download today’s AND tomorrow’s projected starting pitchers?
  2. Why I don’t see the yellow arrow when trying to web query a site in Excel?

And in addressing those two questions, we’ll also take a look at a powerful tactic of using Google Sheets and Excel together to get baseball data off the web. We’ll be focusing closely on obtaining a list of projected starters, but the concepts behind using Google Sheets and tying that back into Excel is one that can be applied in many other areas (like creating spreadsheets for your season long leagues).

Where Can I Find a Reliable and User-Friendly List of Probable Starting Pitchers?

To view the actual HTML code of a site, right click on a web page and choose the option to "Inspect Element". If you don't see < TABLE > references, you may not be able to import the page with Power Query.
To view the actual HTML code of a site, right click on a web page and choose the option to “Inspect Element”. If you don’t see “<TABLE>” references, you may not be able to import the page into Excel.

We all know DFS is exploding and there are countless sites out there providing lineup information, alerts, weather data, and more. But unless I’m looking in the wrong spot, most of that information is intended for that day’s games. And as a father of two with a day job, I can’t practically create a lineup the day of a contest. I need to prepare a day in advance for the next day’s games.

The other challenge in finding this information is that it will be a lot easier to deal with in Excel if we can find the data in a table format (see image to the right, I won’t bore everyone with technical details, but just because data looks to be in columns and rows on a site, doesn’t mean it’s in the format Excel can handle easily).

I have struggled and struggled to find a good resource for tomorrow’s projected pitchers. AND IT HAS BEEN RIGHT IN FRONT OF MY FACE ALL SEASON! Take a look at the Fangraphs home page:

Fangraphs probable pitchers link.

If you visit the “Probables Leaderboard” (here’s an example link), it looks perfect. A table of all the projected starters, and even some friendly advanced metrics we could use in evaluating each player.

Fangraphs probable starting pitchers.

Now take a look at the URL for the page:

Fangraphs probable starting pitchers URL.
The URL for the probable pitchers list is dynamic and changes based upon the day you’re accessing it.

I started to write this post on September 4th. And when I clicked the “Probables Leaderboard” link, it took me to the “p2015-09-04” web address. You can see that last part simply reflects the current date.

Anytime you see a URL like that, with all the different arguments and parameters (like “pos”, “stats”, “lg”, “season”, etc.), you should get excited. It likely means you can manually type in values for those parameters and create your own “query” of the site. Here’s an example I wrote awhile back using Brooks Baseball to illustrate these concepts.

So instead of just using the “p2015-09-04” address, I tried “p2015-9-5”. This was to test two different things. First, to see if I could get tomorrow’s probables in the same table format. Second, to see if the zeros before the month and day numbers were important… And it worked!

Fangraphs dynamic URL
You can edit the URL to see tomorrow’s probable pitchers.

So not only do we have a reliable list of probable starters, we can also get the projected starters for days in advance!

We Need a Dynamic Web Query

While it’s great that we now know where to get tomorrow’s probable starters, the fact that the URL changes each day is a challenge. We’ll need to create a dynamic web query that can determine tomorrow’s date and download the data from the appropriate web address.

With this in mind, I brushed up my memory on how to create a dynamic web query (look for the section titled “Step-by-Step Instructions, Dynamic and Updating Web Query”) and started the process of building it in Excel.

Why Don’t I See the Yellow Arrow in My Excel Web Query Window?

Everything was going so well until I hit a common stumbling block that occurs when web querying in Excel. No yellow arrow displays on the table of data I want to capture in my web query. No yellow arrow displaying in Excel's web query preview window.

Why does this happen? One definite cause is if the information isn’t really in HTML table format (remember that image above?). But the Fangraphs table is in fact a table. I checked. I don’t have a great explanation as to why you don’t always see the yellow arrow, but I imagine it has something to do with how the table is coded or just Excel’s ability to properly process it.

But if you do in fact see that the data is stored in an HTML table, Google Sheets offers a very simple method of doing a web query. One that works even when the yellow arrow box is missing!

Why Don’t You Use Power Query?

Power Query was able to import the table, even when a traditional web query could not... But I can't yet figure out how to create a dynamic query in Power Query.
Power Query was able to import the table, even when a traditional web query could not… But I can’t yet figure out how to create a dynamic query in Power Query.

That’s a really good question. I just spent thousands of words spouting the virtues of Power Query, and in my next post I turn my back on it?

I would like to. But the dynamic web address tripped me up. I spent three days trying to figure out how to get it to work and was unsuccessful.

I ultimately realized that I knew a much easier way to do this with Google Sheets, and this is something I’ve been meaning to demonstrate for a long time. So rather than continue to waste time trying to get Power Query to do the job, why not go with something I already know?

The ultimate irony of the situation is that Power Query didn’t have a problem importing the probables! If I could only have gotten a dynamic query to work…

Enter Google Sheets

If you’re not familiar with Google Sheets, it is a very strong spreadsheet alternative to Microsoft Excel. And it’s free.

So why don’t I write more about using Sheets? Quite frankly, Excel is the better product. It is much more powerful and responsive, largely because it’s an application that runs on my own computer. Google Sheets is web-based and suffers from performance limitations and access issues because of it (if you have a slow internet connection or a lot of calculations in your spreadsheets, you’ll drive yourself crazy using Google Sheets).

With that said, there are some really interesting benefits to Google Sheets. Being free is hard to beat. It’s very easy to share a workbook and work on the spreadsheet at the same time as others. And as I mentioned, importing HTML table data is a snap!

Another really neat feature is that you can publish (or share) the results of a spreadsheet online in CSV format.

And a file in CSV format is easily importable into Excel!

So we can create a Google Sheet to web query troublesome table data. Publish that data as a CSV. And then use Excel (and even Power Query) to import the data into our master spreadsheet.

IMPORTHTML within Google Sheets, publish as CSV, the import the CSV into Excel.
Google Sheets makes the process of querying data from a web page very easy. You can then “publish” you Google Sheet as a CSV file on the web and then use Excel to import the CSV.

Let’s get started!

Prerequisites

To use Google Sheets, you need to have a Google account (if you use Gmail, Google Drive, or any other Google service beyond searching the web, you already have one). If you don’t have a Google account you can create one from the Google Sheets sign up page here.

Google Sheets Functions Used in This Post

IMPORTHMTL

Google IMPORTHTML formula guidance

In Excel, we set up a special connection to pull information from a website. Things are much simpler in Google Sheets. You enter a very simple formula and the data gets pulled into the document.

The specific function we’ll use is “IMPORTHTML”. The function has three inputs:

  1. URL – Enter the web address of the page to be queried in quotation marks. In our example, it will be the address of the Fangraphs Probables page.
  2. Query Type – This is the data type you wish to pull from the web page. You can enter either “table” or “list”. Similar to what we look for when doing an Excel web query, we most likely will be using the “table” option.
  3. Index – This is the instance number of the table (or list) on the web page. Google’s documentation says the index begins at 1, meaning if you want to query the first table on a page you would simply type a 1. If you want the fourth table on a page, you’d enter a 4. But for some reason using a 0 is what works for the Fangraphs page we’ll be using.

MONTH, DAY, and YEAR

These are three separate functions. Each is looking for one input, a date.

The MONTH function will return the numeric representation of the month in the date. DAY returns the numbers from the date string corresponding to the days. And YEAR returns the numbers of the year in the date.

Going back to our example date string from earlier, a formula of =MONTH("09/04/2015") will return “9”.

TODAY

The TODAY function requires no inputs. And when used it simply returns today’s date.

For example, if you enter the formula =TODAY() and look at your spreadsheet on September 5th, 2015, your spreadsheet will display “9/5/2015”.

The formula updates when your spreadsheet recalculates. So if you opened the spreadsheet the next day, the formula would display “9/6/2015”.

You can perform addition with the TODAY function. So if you wanted to display tomorrow’s date, the formula would be =TODAY()+1. Or a week from now would be =TODAY()+7. Knowing that we can add one to the TODAY function will be important to finding tomorrow’s probable starters.

CONCATENATING or BUILDING TEXT STRINGS

By now you probably realize that we’re going to take the beginning of that long Fangraphs URL and then attach the date, as calculated by the TODAY function, to that. Every day these formulas will update and automatically create the new URL to determine tomorrow’s pitchers.

To attach two strings of text together in Google Sheets (or in Excel), you can use the ampersand (“&”). For example, we could put tomorrow’s date in cell A1 of a spreadsheet and then use this formula to build the Fangraphs web address:

="http://www.fangraphs.com/leaders.aspx?pos=all&stats=pit&lg=all&qual=0&
type=8&season=2015&month=0&season1=2015&ind=0&team=0&rost=0&age=0&filter=&players=p"&A1

Step-by-Step Instructions – Create a Google Sheet and Use the IMPORTHTML Function

Step Description
1. Go to the Google Sheets home page and click the button to start a new blank spreadsheet.Start a new Google Sheet
Click on the “Untitled spreadsheet” title and give the file a better name. Maybe something like “Tomorrow’s Probables”.UNTITLED_SPREADSHEET
2. Next, we’ll use the date formulas previously discussed to build the date string to attach to the Fangraphs probable starters URL. Enter the following formula in cell A1:

=YEAR(TODAY())

This should result in just the year of today’s date. As I write this post in September of 2015, the formula returns “2015”.

Now we’ll continue to build on this formula. Add the following to the existing formula in cell A1:

=YEAR(TODAY())&"-"&MONTH(TODAY())

Hit ENTER to accept your changes. See how the ampersand is used to add the hyphen and then another ampersand is used to add the month? As I write this post, that last formula results in “2015-9”. We’ll continue to use the ampersand to add new pieces of text to this string.

Now add the following to the end of the formula:

=YEAR(TODAY())&"-"&MONTH(TODAY())&"-"&DAY(TODAY())

This last piece puts in one more hyphen and then the current day of the month. In my example file it’s showing “2015-9-5”, which is the exact format we need for the Fangraphs page.

But remember, we want to show tomorrow’s date. Not today’s. So make these last final adjustments:

=YEAR(TODAY()+1)&"-"&MONTH(TODAY()+1)&"-"&DAY(TODAY()+1)

The reason we have to add one to all three pieces of the date is to account for when you reach the last day of a month. If you don’t add one to the month component, your day would reset to “1” but your month would still be lagging one behind (e.g. If it’s August 31st and I don’t add one to all of the today formulas, my formula would results as “2015-8-1”, not “2015-9-1”).

3. We’ve completed the last date piece of the Fangraphs web address, so let’s create the full address to the page so that it will update dynamically. Visit the Fangraphs probables page (here’s a link you can use that will lead to an old date). Fangraphs probable pitchers link.
Use your mouse to select all but the end of the URL that contains the date (get the “p” though!).
Copy the entire Fangraphs web address but exclude the date piece of the Fangraphs URL.
Exclude the date piece of the Fangraphs URL.

Copy that URL. Then return to your Google Sheet. In cell A2 type an equal sign then a quotation mark:

="

Then paste the Fangraphs URL and close it with another quotation mark:

="http://www.fangraphs.com/leaders.aspx?pos=all&stats=pit&lg=all&qual=0&
type=8&season=2015&month=0&season1=2015&ind=0&team=0&rost=0&
age=0&filter=&players=p"

Now use an ampersand to append in cell A1 (the missing date component to the end of this formula):

="http://www.fangraphs.com/leaders.aspx?pos=all&stats=pit&lg=all&qual=0&
type=8&season=2015&month=0&season1=2015&ind=0&team=0&rost=0&
age=0&filter=&players=p"&A1

Hit ENTER to complete the formula and you should see a fully usable hyperlink that will take you to tomorrow’s probable starters. IMPORTHTML_URL
To test the hyperlink, hover your mouse over it and then click on the popup that appears.Pop up URL link.

4. There are just two more inputs needed for the IMPORTHTML function. Type TABLE into cell A3 and a zero into cell A4.IMPORTHTML_ARGUMENTS
Now click the downward pointing arrow on the sheet name at the bottom of the screen and then choose the menu option to “Rename…”.Rename sheet
Give this tab or the spreadsheet a meaningful name, like “IMPORTHTML Inputs”.IMPORTHTML_INPUTS
5. Now click the “+” sign, to the left of this newly renamed tab, in order to start a new sheet.Add a new sheet.
Click the downward pointing triangle on this new sheet and rename it to something meaningful, like “Probable Starters”.RENAME_PROBABLE_STARTERS
6. Click your mouse into cell A1 and enter the following formula:

=IMPORTHTML('IMPORTHTML Inputs'!A2,'IMPORTHTML Inputs'!A3,'IMPORTHTML Inputs'!A4)

If you named your first tab exactly the same as I did, you can copy and paste the formula above into cell A1. Or instead of typing out the formula, you can click to your “IMPORTHTML Inputs” tab and select the applicable cells.

Hit enter to accept the formula. After several seconds (depending on the speed of your internet connection), you should see the probable pitchers load!Fangraphs probable starting pitchers list

You can see that it’s very easy to pull data from the web into Google Sheets. Much easier and with fewer steps than in Excel.

7. Before we go on, think for a moment about how an Excel spreadsheet runs its calculations. Similar to Google Sheets, Excel has a TODAY calculation. But if the Excel file containing the TODAY formula was closed for an entire week, we wouldn’t expect that the TODAY formula was updating each day in that closed spreadsheet.

We face a similar problem with this Google Sheet. We don’t want to have to open this list of probable starters each day just so it can update the list. It would be great if there were a property we could turn on so that the spreadsheet would refresh itself every so often… And fortunately Google offers this feature!

Within the Google spreadsheet, go to the “File>Spreadsheet Settings…” menu.File menu, spreadsheet settings

In the ensuing menu, adjust the “Recalculation” setting to the “On change and every hour” setting. This means the spreadsheet will reevaluate the TODAY formula each hour and update the list of probable starters accordingly. Recalculation settings, recalculate on change and every hour.

Click the “Save settings” button to accept this change.

8. The last task we need to complete in the Google Sheet file is to publish the list of starters as an online CSV file.

To start this process, click on the “File>Publish to the web…” menu. Publish Google Sheet as online CSV file.
Click the drop down that currently says “Entire Document”.PUBLISH_TO_WEB_SCOPE
Then choose to only publish the “Probable Starters” tab.PUBLISH_PROBABLES
Now click the drop down that says “Web page” and change it to the “Comma-separated values (.csv)” option.Publish Google sheet as CSV file.
Click the “Publish” button to complete your changes.PUBLISH

9. After you click the publish button, the menu will change to display a link to the published CSV file. Copy this link for now. We’ll need it in the next section. In fact, you may want to copy and paste it into a Word file or some other place for easy access. We will use it again a couple of times.COPY_CSV_LINK
You can always return to review or change these settings under the “Publish to the web…” menu. Just click the “Stop publishing” button, reconfigure the settings to your liking, then republish the document.STOP_PUBLISHING

Google Sheets Wrap Up

Now you see how much more simple the “web query” is in Google Sheets. Especially the creation of a dynamic query that can grab the results of a different page each day with no need for us to update or even open the file! When a new day rolls around, the probable starters list will automatically update in the Google Sheet and in the published CSV file.

The ease of importing data is a huge benefit of Google Sheets, but on the whole I don’t find it to be up to par with Excel. So now let’s take a look at how to get this CSV file into our daily fantasy baseball spreadsheets.

Step-by-Step Instructions – Import a Published CSV File Into Excel

Continue reading “How to Pull Projected Starting Pitcher Information into Your Daily Fantasy Baseball Spreadsheet”

Adding Excel’s “Power Query” to Your Arsenal

About a week ago I got an e-mail from a reader of the site asking me for help using “Power Query” to pull some Fangraphs data into Excel. Power Query is an add-in for Microsoft Excel that offers more advanced data importing options and ability to combine data from different resources.

Power Query is an add-in that will appear on the Excel ribbon.
Power Query is an add-in that will appear on the Excel ribbon.

I knew Power Query existed. But as I was reading the e-mail, my palms began to sweat and an overwhelming sense of guilt washed over me.

“I don’t know anything about Power Query!!!”

Coincidentally, my wife was out of town for the weekend and with the girls in bed early, I had a handful of hours on Saturday night to give myself a crash course in how to use Power Query (ah, the exciting and glamorous nightlife of a baseball nerd!).

And now I might be hooked.

Tables, Tables, Tables!!!

I recently wrote a post (about importing a CSV file into Excel) that included a list of benefit to using Excel tables.

But I missed a really important one… If you import your data into Excel as a table, you create a connection to the data that is linked and can be updated automatically.

Let that sink in for a minute.

I’ve shown you how to make a lot of the Excel file’s that are isolated, dead, and not directly linked to any outside information.

I might have you download some data. Then copy and paste it into Excel. And then convert it into a table. But this is not ideal. The only way to update that information is to manually download it, open the file you downloaded, copy the data, paste it into your file, and cross your fingers that none of your formulas break when you paste over the top of everything.

If we can start importing data directly into Excel as tables, rather than copying and pasting data manually, we can maintain the link to the original data and then very easily update it in the future. And Power Query is capable of helping us do that. It gives more options to create live links to data sources and better options to manage those connections.

Power Query gives us more options to link to live data sources and better options to manage those connections.
Click the link to see a larger version of this image.

Imagine not having to rebuild a new rankings and dollar value file from scratch EVERY season. If you set the file up intelligently, you can use the same file to quickly get in-season values or to update the file for the next season in only a couple of minutes.

Power Query and the Power of Tables

When using Excel's standard web query to import data, you don't have the option to import the information as a table.
When using Excel’s standard web query to import data, you don’t have the option to import the information as a table.

In my limited use of Power Query so far, the thing that has me most excited is that it gives you the ability to import more data sources as tables. We have previously looked at how to use web queries to get information into Excel, but if you use a basic web query, the information does not come in as a table.

Granted, a web query does still leave a live link to the original data. But I want the best of both worlds. I want a live link to the original data AND to import it as a table!

There is a Catch

When using a standard web query (outside of Power Query), you do have the option to import the entire web page. This is messy and loaded with complications, but it’s helpful to have the option.

To view the actual HTML code of a site, right click on a web page and choose the option to "Inspect Element". If you don't see < TABLE > references, you may not be able to import the page with Power Query.
To view the actual HTML code of a site, right click on a web page and choose the option to “Inspect Element”. If you don’t see “<TABLE>” references, you may not be able to import the page with Power Query.

There is no such option in Power Query. You can only use Power Query to web query actual HTML tables from a web site. My educated guess is that to set something up as a table in Excel requires a neat and structured block of data, which querying an entire web page is not.

This is unfortunate, because some really great sites like Baseball Press don’t use tables to present their data. Instead, they use the division (< DIV >) HTML tag.

Downloading Power Query

Despite Power Query not being the silver bullet we need to resolve all our data needs, it’s definitely a tool worth having in the arsenal. And it’s free!

You can download the add in from this page. There are some restrictions you should know about. The program requires at least Windows 7 (sorry again Mac users… you should really look into partitioning your Mac to run Windows).

You also need to be running Excel 2013 (any version) or Excel 2010 “Professional Plus”. After you’ve downloaded the installation, close out of Excel and proceed through the installation. The new toolbar on the ribbon should appear the next time you open Excel. If you’re not seeing a “Power Query” tab, you may need to activate the add-in. Check out the instructions here on how to turn on the add-in (look for the section labelled “My Power Query Tab Disappeared”). POWER_QUERY_ADD_IN

Making Your First Web Query With Power Query

If you’ve read any of my previous pieces on web queries, this really isn’t that much different. The improvement is with the data being in a table and some additional capabilities to fine tune the data that is imported. But let’s take a closer look at how the basic functionality changes.

Step Description
1. The first task is to identify a web page you want to query AND to determine that it does contain HTML tables. My excitement over Power Query is tempered some by that fact that it is difficult to locate useful resources that put their data into tables. Many valuable sites and specific pages don’t!

Remember, to determine if data is in a table, right click somewhere on the web data you would like to capture and choose the menu option to “Inspect Element”.Inspect element

This will load the HTML “code” used to create the web page. If you see references to table, tr (means table row), or td (means table cell), this is a table and a web query should be successful.TABLE_ELEMENTS

A few examples of potentially helpful tables that I’ve found:

  1. FantasyPros.com ROS Projections
  2. Individual Fangraphs Player Pages
  3. Razzball.com ROS Projections
  4. Fangraphs Probable Pitchers List

After you have located a table to import, copy the web page address. For my example, I’ll use the Fantasy Pros rest of season projections (link is http://www.fantasypros.com/mlb/projections/ros-hitters.php). I realize this is not useful for DFS, but I just want to demonstrate the basics of Power Query now.Copy web page URL

2. Open a blank Excel file. Click the newly added “Power Query” tab. Then click the “From Web” icon on the left of the ribbon.Import from Web

Then paste the copied URL into the dialog box and click “OK”.Paste URL

3. The “Navigator” dialog will appear. It may take a minute or two to load as Excel processes each of the tables on the page.

Once the loading process completes, you will see a list of all the tables available for import. Click your mouse to locate the data you want. If you wish to import more than one table, check the “Select multiple items” box.

As you click on the various tables, watch the preview pane on the right in order to locate the exact table you want.Click tables and preview

4. Stop! This step is informational only. Don’t do anything!

At this point, you could click the “Load” or “Load To…” button. LOAD_TO

The “Load” button will import the data exactly as you see it into a newly created worksheet tab.

The “Load To…” option gives you a few more control over how the data loads. In the ensuing menu you have the option to import the table (recommended) or only add the connection to your file (not sure why you would want to do this unless you were unsure of where to place the table now). You can also choose to create a new worksheet or to place the table in an existing spot. Working with data models is something I may explore in the future. If you want to look ahead, you can start hereLOAD_TO_SETTINGS.

Loading from here bypasses some of the real value that Power Query offers. These features are available when you click the “Edit” button.Edit query settings

5. Start! You can start following along again.

Click the “Edit” button and the “Query Editor” will load. In this screen we not only see the preview of the data that will be imported, we can also clean things up.

For example, the first column is labelled “VBR”. This looks like some kind of a ranking, but I don’t want to import this. Additionally, the second column has a lot of information in it. Instead of seeing “Mike Trout(LAA – CF)” all in one column, I want to try breaking that into separate columns.QUERY_EDITOR_SCREEN

Rather than bring it in and have it clog up my screen, we can tell Power Query not to import this column. To do this, click on the “VBR” column to select it. Then click the “Remove Columns” button.CLICK_TO_REMOVE_COLUMN

6. Now let’s move on to splitting apart the player name, team, and position.

Click once on the “Player” column. Then click the “Split Columns” button.SPLIT_COLUMNS

And then click the “By Delimiter” option.BY_DELIMITER

A delimiter is a unique character that represents a change in the field or information. Looking at the data we have, the opening parenthesis is a delimiter between player name and team. There is no option to choose that from the drop down menu, so instead select the “–Custom–” option.CUSTOM_DELIMITER

Then type in the open parenthesis, “(“, and select the option for “At the left-most delimiter”.PARENTHESIS_LEFT_MOST

You should now see that the columns automatically get split!SPLIT_PLAYER

7. Let’s keep going and try to separate out each player’s position. Click the new “Player.2” column and then click the “Split Columns>By Delimiter” menu button again. This time use the settings in the image below to split the column at the hyphen.HYPHEN_DELIMITER

Power Query is really looking useful.PLAYER_TEAM_POS

8. The last thing bothering me is the closing parenthesis after each player’s position. To get rid of this, click to select the “Player.2.2” column and then click the “Replace Values” icon.REPLACE_VALUES

Once the “Replace Values” dialog loads, enter the closing parenthesis in the “Value To Find” field AND LEAVE THE “REPLACE WITH” FIELD BLANK! Then click “OK”.REPLACE_SETTINGS

Check this out…CLEANED_DATA

10. Now that the data is cleaned up, click the “Close & Load To…” button on the “Home” tab of the ribbon.CLOSE_AND_LOAD_TO

This will load the same “Load To” box discussed earlier. Adjust the settings as you see fit and click the “Load” button when you’re done.LOAD_TO_SETTINGS

The data loads exactly as you cleaned it up!CLEANED_TABLE

This Is Not the Best Example

Because I’m in the middle of a series of DFS-related blog posts, I wish I had a more concrete example that specifically tied in DFS information. But I did want to demonstrate the power of cleaning and tweaking data with Power Query. Hopefully you can recognize there is a great deal of value in knowing these tools exist so you can use them to solve issues as you build your own DFS spreadsheet with the information you like using.

I’ve included a couple more links below that may help you down the Power Query path.

As always… stay smart.

Are You Using Power Query? Other Add-Ins?

Is anyone using Power Query already? What kinds of things are you using it for? What sites are you loading the data from?

I’d love to hear it if you are. Please e-mail me or leave a comment below.

Other Resources

I’ve only given a brief overview of the full capabilities. If you’re intrigued and looking for more examples, check out these additional resources below.

Name Description
Download Page Free download page. Power Query is free, but it does require you to have Excel 2013 or Excel 2010 “Professional Plus” (I don’t know exactly what that means). It also requires you be using at least Windows 7.

If you’ve been on the fence about upgrading to the newest version of Excel, I list out a few of the purchasing options here.

Interactive Online TutorialIf you choose only one of these items to click on. Choose this one. The demo is only a few minutes long, but it does a great job of demonstrating how you can really fine tune and clean up the data you import through Power Query.
Interesting Examples that Might Apply to Baseball DataThis is a fairly lengthy post, but look specifically for the sections labelled “Append (Combine) Tables with Power Query”, (I could see this being a way to import a player’s last three seasons of data, or to import multiple projection systems) and “Merge Tables – A VLOOKUP Alternative” (a way to combine DFS salaries with info from other sites).
Introduction to Power QueryThis is simply a written explanation of Power Query and its features and benefits. More detailed than I’ve explained above.
Advanced Example, Dynamic and Multi-Layered QueriesI started this post off by referring to a question I received from a reader of the site. He wanted to provide Excel with a list of player IDs and then have it systematically go out to the player pages for each of those IDs and pull back data.

I wasn’t sure this was possible in Excel, but turns out that it is! This resource demonstrates how to make advanced edits to your query to make it dynamic (to ask for a player ID) and to make it multi-layered. Said another way, you can have one query go and fetch a list of player IDs and you can have a subsequent query run off each of those IDs. “Hey Excel, go get this list of players. Then go through each player on that list and go get me the standard data from their Fangraphs page.”

It’s slow… But it works.