Library to get data from Tableau Viz
Project description
Tableau Scraper
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)
- 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)
- 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)
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
Project details
Release history Release notifications | RSS feed
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.7.tar.gz
(8.1 kB
view hashes)
Built Distribution
Close
Hashes for TableauScraper-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 836b0091e65e593ec06c37646af57f594a07a1b61569bae0f9987c47ae067bc1 |
|
MD5 | e923fc1a6e47094559559d3bb95f58e8 |
|
BLAKE2b-256 | 8fb0edbcc0f89200f11108f4bd3e9ffb7253ae092c56c73a093e8e134ffce73a |