bertrandmartel / tableau-scraping

Tableau scraper python library. R and Python scripts to scrape data from Tableau viz
MIT License
131 stars 21 forks source link

Cannot locate function to manipulate drill/up down #21

Closed az-data-guru closed 3 years ago

az-data-guru commented 3 years ago

URL: https://tableau.azdhs.gov/views/ELRv2testlevelandpeopletested/PeopleTested?%3Aembed=y

On the bottom left and right hand there is a plus/minus that calls a render-tooltip-server. The render-mode still shows client so I am unsure if this data can be extracted. I need to drill down to daily. Please let me know if I am missing something.

vzresponse

bertrandmartel commented 3 years ago

I've just implemented the level drill up/down in v0.1.15. The following will drill down 3 times:

from tableauscraper import TableauScraper as TS

url = 'https://tableau.azdhs.gov/views/ELRv2testlevelandpeopletested/PeopleTested'
ts = TS()
ts.loads(url)
wb = ts.getWorkbook()

sheetName = "P1 - Tests by Day W/ % Positivity (Both) (2)"

drillDown1 = wb.getWorksheet(sheetName).levelDrill(drillDown=True, position=1)
drillDown2 = drillDown1.getWorksheet(sheetName).levelDrill(drillDown=True, position=1)
drillDown3 = drillDown2.getWorksheet(sheetName).levelDrill(drillDown=True, position=1)

print(drillDown1.getWorksheet(sheetName).data)
print(drillDown2.getWorksheet(sheetName).data)
print(drillDown3.getWorksheet(sheetName).data)

Try this on repl.it

I'm still not sure how to find out the position parameter which is an integer I've default to 0. It doesn't seem to be present in the json configuration. I guess it's the index of the 1st drillable table but can't find any references of that