How can I extract values from Tableau dashboard

0 votes

I am trying to extract the "Company & Tests" values from this Web page:

The preferred output would be a array with company and number of tests for each company.

There is another thread (How can I scrape tooltips value from a Tableau graph embedded in a webpage) with a similar question..

I tried to work with that and it didn't work in my case

Thank You.

import requests 
from bs4 import BeautifulSoup
import json
import time

data_host = ""

r = requests.get(
    params= {
soup = BeautifulSoup(r.text, "html.parser")

tableauData = json.loads(soup.find("textarea",{"id": "tsConfigContainer"}).text)

dataUrl = f'{data_host}{tableauData["vizql_root"]}/bootstrapSession/sessions/{tableauData["sessionid"]}'

r =, data= {
    "sheet_id": tableauData["sheetId"],

dataReg ='\d+;({.*})\d+;({.*})', r.text, re.MULTILINE)
info = json.loads(
data = json.loads(

print(data["secondaryInfo"]["presModelMap"]["dataDictionary"]["presModelHolder"] ["genDataDictionaryPresModel"]["dataSegments"]["0"]["dataColumns"])
Apr 8 in Tableau by Vaani
• 5,240 points

1 answer to this question.

0 votes

Your tableau address is using server side rendering in this situation. It means that no data is supplied to the browser by default, and the server renders visuals with the data (tables, maps, etc.). Selection events are triggered by JS sending mouse coordinates to the server.

However, utilising the filters, you can have some info rendered client-side in your situation. When you choose a filter, such as "specimen," the data is rendered on the client (actual data are sent to the browser).

To extract data from Tableau workbooks, I created a tableau scraper library. You may run the following code to import the tableau data (empty worksheets), get the filter in the Diagnostic Target called Specimen worksheet, and save it. Get the worksheet data for each of these by collecting and iterating each value of this filter:

from tableauscraper import TableauScraper as TS
import pandas as pd

url = ""

ts = TS()
workbook = ts.getWorkbook()

ws = workbook.getWorksheet("Diagnostic Target")

specimens = [
    for t in ws.getFilters()
    if t["column"] == "Specimen Collected"

pdList = []
for specimen in specimens:
    print(f"specimen: {specimen}")
    specResultWb = ws.setFilter("Specimen Collected", specimen)
    df = specResultWb.getWorksheet("Company and Tests").data

result = pd.concat(pdList, ignore_index=True)

answered Apr 21 by Neha
• 6,260 points

Related Questions In Tableau

+2 votes
1 answer
0 votes
1 answer

How can I remove { } from columns in Tableau?

Create the following calculated field and use ...READ MORE

answered Aug 10, 2018 in Tableau by Atul
• 10,230 points
0 votes
1 answer

How can I automate publishing dashboard to Tableau server?

Getting data from excel to Tableau Server: Setup ...READ MORE

answered Oct 10, 2018 in Tableau by sdfg
• 5,550 points
0 votes
1 answer

How can I use Tableau to create a heatmap?

Step 1: Create an Excel Spreadsheet with ...READ MORE

answered Apr 2, 2018 in Tableau by sdfg
• 5,550 points
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,762 views
0 votes
1 answer
0 votes
1 answer

How can I automatically add pictures in Tableau Tooltip?

Another alternative is to utilise the Viz ...READ MORE

answered Apr 5 in Tableau by Neha
• 6,260 points
0 votes
1 answer
Send OTP
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP