Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Pull Tableau Dashboard Images with Alteryx Macro

alberto_herni
9 - Comet

It's a common request from Alteryx Designer users to be able to get Tableau Dashboard screenshots to include them in PDFs, PPTs or simply distribute by email to others users without access to Tableau Server.

 

I have created two macros that connect to Tableau Server API (version 2.5) to pull Tableau dashboard images and use them in Alteryx.

 

Macros are super easy to use:

  1. Enter your Tableau user&pass details.
  2. Fill text boxes with the required details to connect your Tableau Server and get access to the desired view.
  3. Run and get the image!

 

alberto_hernie_0-1620224218542.png

 

 

Tableau IMG Downaloader macro creates API calls to get the Auth token, workbook list and view list. Then you are allowed to select the workbook and the view you want to get a screenshot.

 

Tableau IMG Downloader Filter macros works in the same way but allows you to pass a field with values to filter the view and get multiple filtered screenshots.

 

The macros will also pass the image as blob.

 

Kindly note that the maximum number of workbooks/views the API call can pull is 1,000. If you need to pull +1,000 you will have to add the page number in the API calls according to Paging Results-Tableau Server REST API - Tableau.

 

alberto_hernie_1-1620224289137.png

 

 

Get Tableau IMG Downaloader from the Alteryx Public Gallery: Alteryx Analytics Gallery | Tableau IMG Downloader

Get Tableau IMG Downaloader Filter from the Alteryx Public Gallery: Alteryx Analytics Gallery | Tableau IMG Downloader Filter

 

Please let me know your thoughts and report any bugs 😉

 

Alberto Hernandez

 

17 REPLIES 17
jai_cotman
7 - Meteor

First, let me say this is an awesome macro and I love that it'll pull snapshots of published dashboards to include in email summaries.  With that said, I'm curious to know if anyone else is having this issue.

 

I'm publishing the workflow to our Gallery server to run on automation.  When it runs, even as a separate workflow from the one that updates Tableau, the screenshot that I get is cached.  What I mean by that is I continue to get a screenshot from the last time I updated the workflow (last update 27 June 2023).  The only time I pull current data is if I remove the macro, replace it with a new macro, and then run it locally.  

 

Am I missing something in the settings that is causing the caching issue...or is that normal behavior and I have to just stick to running this manually and having others of my team understand how to do this, should I be out or switch roles/jobs/leave my current employer?  Thanks in advance!

alberto_herni
9 - Comet

hi @jai_cotman, happy to hear that you found the macro useful!

 

The Tableau API works in a way that if you make multiple requests for an image, subsequent calls return a cached version of the file. To decrease the amount of time that a workbook is cached, you can use the maxAge parameter (minimum of 1 minute). In order to implement this parameter in the get image api call you can do the following:

 

  1. Go to Formula Tool (#10)
  2. Remove the existing formula --> [server] + "/api/2.5/sites/" + [site_id] + "/views/" + [tabid] + "/image?resolution=high"
  3. Enter the following --> [server] + "/api/2.5/sites/" + [site_id] + "/views/" + [tabid] + "/image?resolution=high&maxAge=max-age-minutes"

 

Then you can replace the final 'max-age-minutes' by a fixed value or use a Numeric UpDown tool, from the Interface tool section, to make it based on the user selection.

 

I also updated the macros on the Gallery to include this max age parameter so you can download it again and check.

 

Tableau Image Downloader - Alteryx Community

Tableau Image Downloader + Filter - Alteryx Community

 

Hope this resolves your issue.

 

BR,

Alberto

jarrod_r
7 - Meteor

I have been using your macro for a few months now in production and it works great! (I was playing around with it last year to see if it would work for what I needed and it does!)

 

 

I was wondering, though, if there was a way to modify the macro to output a PDF from the view rather than an image? I was trying to dissect the macro and figured out how all the parts work. I tried plugging in "/pdf" in the final download tool with an output file path. 

I get it to output a PDF file, but it doesn't seem to actually be a real file (get an error when attempting to open the file). The header returned from the Tableau server is:

 

HTTP/1.1 404
Date: Fri, 01 Sep 2023 04:05:06 GMT
Server: Tableau
tableau_error_source: NeedsClassification
tableau_status_code: 5
tableau_error_code: 0x74F4C8E5
tableau_service_name: vizportal
Content-Type: application/xml;charset=UTF-8
X-Tableau: Tableau Server
P3P: CP="NON"
X-UA-Compatible: IE=Edge
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: no-referrer-when-downgrade
Content-Security-Policy-Report-Only: connect-src * https://*.tiles.mapbox.com https://api.mapbox.com; default-src blob:; font-src * data:; frame-src * data:; img-src * data: blob:; object-src data:; report-uri /vizql/csp-report; script-src * blob:; style-src * 'unsafe-inline'
Transfer-Encoding: chunked

 

 

Any thoughts?

jarrod_r
7 - Meteor

Well, I figured it out! It was the API version! Needed to use 3.11!

adoen17
9 - Comet

Excellent macro, but I have the error of Incorrect authentication, using my credentials, I dont know if you have any suggest to this. @alberto_herni 

gokulraj_23
5 - Atom

i got the same error, :Incorrect Authentication" were you able to fix it ?

adoen17
9 - Comet

No, maybe a problem with the API and tableau in our organization

jarrod_r
7 - Meteor

Do you know if something similar is possible with Power BI? I can't seem to find anything for it. ☹️

Labels