Skip to main content

Library to get data from Tableau Viz

Project description

Tableau Scraper

PyPI CI codecov License

Python library to scrape data from Tableau viz

R library is under development but a script is available to get the worksheets, see this

Python

Install

pip install TableauScraper

Usage

  • Get worksheets data
from tableauscraper import TableauScraper as TS

url = "https://public.tableau.com/views/PlayerStats-Top5Leagues20192020/OnePlayerSummary"

ts = TS()
ts.loads(url)
dashboard = ts.getDashboard()

for t in dashboard.worksheets:
	#show worksheet name
	print(f"WORKSHEET NAME : {t.name}")
	#show dataframe for this worksheet
	print(t.data)

Try this on repl.it

  • select a selectable item
from tableauscraper import TableauScraper as TS

url = "https://public.tableau.com/views/PlayerStats-Top5Leagues20192020/OnePlayerSummary"

ts = TS()
ts.loads(url)

#show selectable columns
columns = ts.getWorksheet("ATT MID CREATIVE COMP").getSelectableColumns()
print(columns)

#show values by column name
values = ts.getWorksheet("ATT MID CREATIVE COMP").getValues("ATTR(Player)")
print(values)

#select that value
dashboard = ts.getWorksheet("ATT MID CREATIVE COMP").select("ATTR(Player)", "Vinicius Júnior")

#display worksheets
for t in dashboard.worksheets:
	print(t.data)

Try this on repl.it

  • select item in a dropdown
from tableauscraper import TableauScraper as TS

url = "https://public.tableau.com/views/PlayerStats-Top5Leagues20192020/OnePlayerSummary"

ts = TS()
ts.loads(url)
dashboard = ts.getDashboard()

#show dropdown input name
inputNames = dashboard.getDropdownInputs()
print(inputNames)

#show dropdown values for a given input name
values = dashboard.getDropdownValues("P.League 2")
print(values)

#select that value
dashboard = dashboard.setDropdown("P.League 2", "Ligue 1")

#display worksheets
for t in dashboard.worksheets:
	print(t.data)

Try this on repl.it

Sample usecases

Testing Python script

To discover all worksheets, selectable columns and dropdowns, run prompt.py script under scripts directory :

git clone git@github.com:bertrandmartel/tableau-scraping.git
cd tableau-scraping/scripts

#get worksheets data
python3 prompt.py -get dashboard -url "https://public.tableau.com/views/COVID-19inMissouri/COVID-19inMissouri"

#select a selectable item
python3 prompt.py -get select -url "https://public.tableau.com/views/MKTScoredeisolamentosocial/VisoGeral"

#select an item in dropdown
python3 prompt.py -get dropdown -url "https://public.tableau.com/views/COVID-19DailyDashboard_15960160643010/Casesbyneighbourhood"

Settings

TableauScraper class has the following optional parameters :

Parameters default value description
logLevel logging.INFO log level
delayMs 500 minimum delay in millis between actions (select/dropdown request)

R

under R directory :

Rscript tableau.R

R library is under development

Stackoverflow Questions

See those stackoverflow posts about this topic

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TableauScraper-0.0.10.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TableauScraper-0.0.10-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file TableauScraper-0.0.10.tar.gz.

File metadata

  • Download URL: TableauScraper-0.0.10.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for TableauScraper-0.0.10.tar.gz
Algorithm Hash digest
SHA256 f9d0eba6d910200ca5923d44534e2c4b39b7dba0588fbf9b58ac978c9f332616
MD5 e9d442866d75e3faa4555cff0e425496
BLAKE2b-256 e64e4d0dd3ed8fb6cb5b5d3cf94b60006358c87640919acfdf0beee64f6e7e53

See more details on using hashes here.

File details

Details for the file TableauScraper-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: TableauScraper-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for TableauScraper-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a2839eb67d97714c15950a0116e43d3156748e51853f35bb8d9d242a424622ee
MD5 6c680e1e3d81c07d2ca517200d1d6216
BLAKE2b-256 57186235b5d7e90a393f4cd4c410f99f68f3be44a8b7dc0ba2230d8867b30704

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page