Get your stats from Wikipedia to Tableau
This week legendary football player Diego Maradona passed away. With the passing of one of the greatest players the sport has ever seen, the ‘who is better’ questions started reaching the surface again. Was he the greatest player of all time? How would he compare against players of the current generation? This is of course an impossible question to answer, but nevertheless I thought it would be fun to compare the old number 10 of Argentina against the new one.
Getting your data from Wikipedia
Wikipedia is not just a great place for anyone who ever needed to do homework, or had to write an essay on anything. It’s also a great place to get some data!
If you look up Diego Maradona you find a couple of tables with data, including some stats of his appearances for the national team of Argentina.
Since he’s not playing anymore (I am aware this is an understatement), you can just copy and paste his data to an excel file or google sheets.
The same goes for the Wikipedia page of Messi. Here we also find stats on his appearances in the national team, but unlike Maradona, these stats are still being updates whenever he plays a game. You would like to have this new information in the dashboard too, so how can we keep our data up to date automatically?
There is a trick for that, and you’ll need to use Google Sheets. You can automatically import a table from a website such as Wikipedia to your sheet if you use the formula =IMPORTHTML(“website URL”, “table”, index). The index starts at ‘1’, and identifies which table or list as defined in the HTML source should be returned.
This is perfect for the Messi data, which will be updated after his next appearance/goal.
In cell A1 we type the formula and automatically we see the table imported.
Now we can connect to Google sheets in Tableau and build a dashboard where we compare the two legendary players. And whenever the data on Wikipedia is updated, so will the table in Google Sheets. And if you have your dashboard set to a live connection: so will your dashboard.
If you want to publish the dashboard to Tableau Public you have to make an extract of the data first. However, when you publish you get the opportunity to select ‘Keep my data in sync with Google Sheets and embed my Google credentials.’
So your dashboard will be updated even though it’s an extract. After publishing you can see when the data is last updated, and you also have the option to trigger an update.
This is a simple way to create some nice, up to date, dashboards. As far as my dashboard is concerned, we see that Messi has a higher scoring rate than Maradona, so he is more effective when it comes to scoring goals. However, we all know who one a world cup and who didn’t.. So let’s keep the debate going!