[null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/files/public/2017/9/9/f249d697-bb28-49da-98bb-4e09152b5712.jpeg", "src": "https://filedb.experts-exchange.com/files/public/2017/9/9/f249d697-bb28-49da-98bb-4e09152b5712.jpeg", "formatted_filename": "f d bb da bb e b"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154640/tqSplash.png", "src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154640/tqSplash.png", "formatted_filename": "tqSplash"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154641/tqSchema1.png", "src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154641/tqSchema1.png", "formatted_filename": "tqSchema"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154642/tqSchema2.png", "src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154642/tqSchema2.png", "formatted_filename": "tqSchema"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154643/tqSchema3.png", "src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154643/tqSchema3.png", "formatted_filename": "tqSchema"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154644/tqSchema4.png", "src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154644/tqSchema4.png", "formatted_filename": "tqSchema"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154645/tqSchema5.png", "src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154645/tqSchema5.png", "formatted_filename": "tqSchema"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154646/tqSharePoint1.png", "src": "https://filedb.experts-exchange.com/incoming/2017/04_w14/1154646/tqSharePoint1.png", "formatted_filename": "tqSharePoint"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/files/public/2017/9/9/f249d697-bb28-49da-98bb-4e09152b5712.jpeg", "src": "https://filedb.experts-exchange.com/files/public/2017/9/9/f249d697-bb28-49da-98bb-4e09152b5712.jpeg", "formatted_filename": "f d bb da bb e b"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/files/public/2018/9/1/735fd7f8-1c51-4c1c-b634-97f7d3f689b3.jpeg", "src": "https://filedb.experts-exchange.com/files/public/2018/9/1/735fd7f8-1c51-4c1c-b634-97f7d3f689b3.jpeg", "formatted_filename": "fd f c c c b f d f b"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/files/public/2018/9/3/e2a3083d-2411-4160-99d2-808cabc21beb.png", "src": "https://filedb.experts-exchange.com/files/public/2018/9/3/e2a3083d-2411-4160-99d2-808cabc21beb.png", "formatted_filename": "e a d d cabc beb", "alt_text": "The Five Tenets of the Most Secure Backup"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://d22xog6qk9dtd5.cloudfront.net/encoded/7798/How-to-set-priority-of-transport-age_1_Medium.jpg", "src": "https://d22xog6qk9dtd5.cloudfront.net/encoded/7798/How-to-set-priority-of-transport-age_1_Medium.jpg", "formatted_filename": "How to set priority of transport age Medium"}, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/files/public/2018/0/7/289572e6-9348-4406-b3f5-5f6ff4d40349.png", "src": "https://filedb.experts-exchange.com/files/public/2018/0/7/289572e6-9348-4406-b3f5-5f6ff4d40349.png", "formatted_filename": "e b f f ff d"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://d22xog6qk9dtd5.cloudfront.net/encoded/9866/Loops-Section-Overview_1_Medium.jpg", "src": "https://d22xog6qk9dtd5.cloudfront.net/encoded/9866/Loops-Section-Overview_1_Medium.jpg", "formatted_filename": "Loops Section Overview Medium"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/files/public/2018/4/14/6878e433-a2c7-40c1-ac81-ea848ec56175.jpeg", "src": "https://filedb.experts-exchange.com/files/public/2018/4/14/6878e433-a2c7-40c1-ac81-ea848ec56175.jpeg", "formatted_filename": "e a c c ac ea ec"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/files/public/2018/8/10/126d94c6-11b7-4e84-8f79-ae14f6ff60e4.jpeg", "src": "https://filedb.experts-exchange.com/files/public/2018/8/10/126d94c6-11b7-4e84-8f79-ae14f6ff60e4.jpeg", "formatted_filename": "d c b e f ae f ff e"}, null, {"document_url": "https://www.experts-exchange.com/articles/29470/Harvesting-Tableau-User-Queries-with-PowerShell-and-SharePoint.html", "unformatted_src": "https://filedb.experts-exchange.com/files/public/2018/9/1/80351932-80b5-41fb-8404-2309467d34b9.jpeg", "src": "https://filedb.experts-exchange.com/files/public/2018/9/1/80351932-80b5-41fb-8404-2309467d34b9.jpeg", "formatted_filename": "b fb d b"}, null]


Harvesting Tableau User Queries with PowerShell and SharePoint

3,868 Points Greg Besso
Continually learning and practicing with Microsoft technology solutions to make positive impacts in user productivity.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...

Recently a colleague asked if we could find out what queries users were creating within Tableau Desktop and Server, so that they could be reviewed and possibly re-used in other systems that also reported on those same data sources. I did some research and found out that this was indeed “a thing”. Here are my notes about how to extract user queries from one of these files and share them via a SharePoint list… Step 1: Define where the user queries are stored

I found that there are several files that can be parsed to gain insight into queries that users are creating, both on Tableau Desktop and Tableau Server. Here is a list of the files I came across…

For Tableau Desktop instances…

* The log.txt and tabprotosrv.txt files store data related to live connections while tdeserver.txt stores data related to data extracts.

For Tableau Server instances…

Step 2: Review the format and accessibility of the queries within these files

The files are all in the JSON format. If you’d like to open the files in Tableau Desktop to peek in, you should rename them to .json and then open them.

I’ve found so far that there are many details captured in these files, but the lines I focused on here are the ones that have begin-query and also where the query starts with SELECT.

Step 3: Choose how and what to parse from the queries

How might you go in and figure out what you even need? The first step is to open the files to take a look. You could open the .txt files, but when you rename them to .json first, Tableau Desktop gives you some more options that pull a lot more data and make it a lot easier to get to the details… When you first open a JSON file, you’ll get a prompt to select the schema items you want. I just checked the top left “select all” box and then clicked OK. The file will open as a datasource. Look for the “K” column and then sort by that column. Look for the begin-query items. If you scroll all the way to the right, you’ll find a “Query” column. This should have some items with SELECT statements. For this example, that’s what I am looking for.

You don’t see it all in the Tableau view, but if you copy/paste out to Notepad for example, you can see that the full query is there. The various files you can open are all similar, but you’ll see that the tabprotosrv.json file has even more details for the queries compared to the log.json file. Step 4: Choose where to store the chosen details from the queries

Once you’ve figured out that the files you’ve gathered have data you think is useful, you may be like me and say to yourself “wouldn’t it be awesome if I could just extract all these queries and make them available for the team to view from within a SharePoint list instead of having to sift through JSON in Tableau?”

Here is one example view of how you can slice and dice the gathered data once you have it in SharePoint… If that is what you would like to do, then you can see what I did below. I took another existing project that I made a while back that writes XML records out to SharePoint (creating the list and columns mentioned if they don’t already exist) and then do all the heavy lifting for you. All you’d need if you’re already doing that is to export this JSON into XML to make that system be able to consume these queries as new list items.

I’ll spare you the death by PowerShell experience but put some notes on how I chose to get this working. Here are some notes…

This is a work in progress but I put my script for this up on my GitHub for future access. It’s here:

Also the SharePoint list project I’m using here is part of a larger project that I labeled as my PSMANAGE scripts. If you would find it useful you can check that out, or just ask and I’ll try to extract just the pieces needed to do the SharePoint Online list updates into a new smaller project. It’s described here if you would like to check that out:


kb.tableau.com, “Viewing Underlying SQL Queries”

tableau.com, “Server Log File Locations”

Author:Greg Besso Loops Section Overview
Video by: Adam


 OWASP Proactive Controls Next Article:Preparing, Migrating users and Handling contacts between two forests in Microsoft Exchange Cross Forest migration

