3 Methods for Excel Download Buttons in Tableau

 


In my work dashboards, it's very common for me to allow my users to download certain data. Some people think that this is a weakness, that my dashboard didn't answer their questions well enough, so they are forced to download the data to explore themselves. However, this is not the reason that my users want it. Most of the time that I allow this, I am doing it so that a user can copy and paste account numbers into another system or create a checklist to work off of (say I provided a list of all the accounts without a resolution, they could download that list as their own checklist).  


So how do we create a download button?  There are three major techniques, all with great benefits and some drawbacks. I actually utilize all three methods, so I thought I'd share the techniques and my personal view of their pros and cons. 




1) The "Andy Kriebel" Technique


I learned about the Andy Kriebel technique early on in my career and I've never forgotten it...I just search for "Andy Kriebel Greatest Tableau Tip Ever".  Andy's already written all about it, so I won't spend a lot of time describing how to perform the technique.  Go read his short blog post and come back here when you are done.


Waiting


Waiting


Waiting


Okay, you've read it, right?  How cool is that????  Big kudos to Andy for figuring that one out!  


Now that you have a link, you can then add an image of a button (feel free to use our button cheat sheet) then take that CSV URL and add it as the "URL Opened When Image is Clicked" field of the image.  






I was floored when I first read that blog post and it helped a ton because up to that point, I was unaware of any other ways of creating a download button for my users.  (There may have been other methods, but I wasn't aware of them). 


Okay, what are the pros and cons of this technique?  Well, the technique is super easy: make sure the sheet you want to download is first alphabetically, publish the dashboard, grab a link, change the end of the link to be csv, then add that to a button.  It's quick and works great!  



There are, however, two issues that I am aware of.  1) The download list is static. If you drill down into your data using filters, this technique will still download your entire list - it will still download the full list.  2) It does not give you a ton of control over how the data is downloaded.  For example, if you use Measure Names & Values, your downloaded spreadsheet will include a column named "Measure Names", which might be confusing to your users.  I've also noticed on numerous occasions (typically when using only discrete pills ), the download will contain duplicated columns.  It's something that I never really found a solution to. 


But in general, if you want a quick way to allow your users to download the full data from one sheet, this is a fantastic technique.  




2) Tableau's Download/Export to Crosstab Button



This functionality was introduced in version 2020.3 - about two years ago. I was so excited about this feature and wrote about it in my blog post "Five Awesome New Features of 2020.3" (open the link and search for "3. Export to Crosstab Button").  Okay, go read this section of my blog post and come back here when you are done.


Waiting


Waiting


Waiting


Okay, you've read it, right?  This is a super easy technique. And it will only download the data in the viz...that means if you filter the sheet you are downloading, you will download just the filtered data - AWESOME.


That said, there are two major drawbacks.  


1) When you add a download button in Tableau, you can set it to download a PDF, Image, PowerPoint, or Crosstab. If you choose any option other than Crosstab, you can click the button in Tableau Desktop to try it out. However, if you set it to Crosstab, the button is grayed out and does not work in Desktop. You must publish the workbook before it works. Okay, not a huge deal, but it sure would be nice to see what it looks like while designed and also be able to test it. 


2) The second is something I mentioned in the blog post that you just read.  The download to crosstab button will display to your user all worksheets in the dashboard. So if you have a dozen sheets, all of them will show.  In 99% of cases where I allow the download of a crosstab, I want to limit it to one specific worksheet. There are so many cases where I wouldn't want a user to be able to download data. For example, it may make no sense for a user to download data associated with a complicated chart or one utilizing data densification or scaffolding. I typically build a table specifically for download. And at the current moment in time, there is no way for a developer to specify which sheets can be downloaded.  


The drawbacks of this technique (especially #2) make using it a bit challenging. I've done a few hacky things to make this work like naming every sheet except the one I want to allow to be downloaded with a blank character, then two blank characters, etc. That way when a user clicks the button, it's obvious which one should be downloaded.  But I'll admit, in general, I don't love this solution simply because it's confusing to users.  (Note, I created an idea on the ideas forum to allow developers to specify downloadable sheets - please upvote if you agree with me). 




3 Information Lab's Export All Extension



A couple years ago, the brilliant folks at The Information Lab created an "Export All Extension".  You first need to download the extension.  Then in Tableau, drag an extension to the dashboard and select the one you just downloaded. It will take a few seconds to load, then you can click the arrow and choose Configure.  (For more specific details on using extensions, see this article in the Tableau Knowledge Base). 


When you configure the extension, you'll see three options at the top: Select Sheets, Select Columns, and Configure.  Using these options, you can dictate which sheets can be downloaded and in what order, you can specify the columns to include in the download (as well as relabel and reorder them), and you can provide some customization of the button.  When a user clicks the button, it will download all sheets into a single Excel file with each sheet (that you allowed) as its own tab of the Excel worksheet (and in the order you specified).  


This solves a ton of the problems we had above (and is likely my preferred method).  If you filter the data, it will download that filtered data (not the full data), and you can specify the sheets (and columns as a bonus), and it works in Tableau Desktop.


But like all the others, there are some drawbacks.  



1) First, if using it on Tableau Server or Online, your organization will have to allow the use of extensions and allow the use of this specific extension.  For more information, please consult this article on the Tableau Knowledge Base. In my experience, only a small percentage of companies allow extensions.  


2)The second drawback is that there are very limited button formatting options. You can add a label and have three different button design options, but that's it. You can't control the color, the font, or the size.  You could likely place this on top of a nicely designed image and make it look like a decent button, but you are still quite limited. 


My company does allow the use of extensions in certain situations and this technique solves the biggest problem of them all by allowing developers to dictate the sheets that can be downloaded. This makes it my favorite of the three techniques.




BONUS: Andy Kriebel + Jonathan Drummey + Jeff Shaffer + Ethan Hahn



I know that the title of this blog post mentions just three techniques, but I'm going to briefly mention a fourth.  Because all the current techniques have pitfalls, my colleague Ethan Hahn worked out another technique and wrote about it on our website. You can read his blog post here


Before you read this blog post, you'll want to know that it's somewhat complicated and takes significantly longer to build than all other methods.  It does, however, pretty much solve all of the problems discussed above.


Ethan brilliantly takes the Andy Kriebel technique and combines it with some Jeff Shaffer, Jonathan Drummey, and Ethan Hahn trickery to construct a URL that solves all the problems!  I won't ruin it for you and I'll simply encourage you to read the blog post - it truly is brilliant and introduces a ton of great techniques that you can also use for things outside of just download buttons.  But again, I will warn you...it's not for the faint of heart.  




Okay, that's it, three methods for download buttons in Tableau. Thanks for reading and feel free to reach out if you have any questions.





Thanks!




Kevin Flerlage, January 9, 2023

Twitter LinkedIn Tableau Public



6 comments:

  1. Can we download the data in .xls format by above method ?

    ReplyDelete
    Replies
    1. When you set a download button to "crosstab", it allows the user to download as a csv of xls.

      Delete
  2. But Export extension does not work for huge data both in tableau desktop and tableau server.
    any work arund for this ?

    ReplyDelete
    Replies
    1. I didn't know that was the case. Can you use one of the other methods?

      Delete
  3. Can we export data into two tabs of same excel file from two diff dashboards of same workbook?

    ReplyDelete
    Replies
    1. I believe the extension I talked about above does have some customizable features...might be worth checking this out.

      Delete

Powered by Blogger.