server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

Extract All Worksheets from dashboard

Open SimonGitter opened this issue 3 years ago • 3 comments

Summary

Is there a way to extract data for all worksheets from a given dashboard?

Description

When attempting to extract data from a dashboard only the first sheet is extracted.

Example from dashboard: image

If sheets are embedded in a dashboard how can one extract data from all worksheets on a given dashboard? Only the first sheet will be extracted.

Example for extracting all views of a "workbook"

import os
with server.auth.sign_in(tableau_auth):
    for wb in TSC.Pager(server.workbooks):
        if 'APITest1' in wb.name:
            print(f"{wb.name=}, {wb.project_name=}, {wb.id=}, {wb.content_url=}, {wb.owner_id=}")
            server.workbooks.populate_views(wb)
            print([view.name for view in wb.views])
            for view in wb.views:
                server.views.populate_csv(view)
                print(f"{view.name=}, {view.id=}, {count=}, {view.content_url=}, {view.workbook_id=}")
                try: 
                    os.makedirs("./"+config.output_dir+"/"+view.content_url)
                except:
                    pass
                with open('./'+config.output_dir+"/"+view.content_url+'/'+view.id+'.csv', 'wb') as f:
                    f.write(b''.join(view.csv))   

output: As you can see only one view is listed and can be extracted.

  wb.name='APITest1'
  ['Dashboard 1']

Dashboard example: 3 sheets are being displayed in the dashboard image

When publishing the sheets the output look like this.

  ['a', 'b', 'c', 'Dashboard 1']

https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_ref.htm image

SimonGitter avatar Jan 04 '23 16:01 SimonGitter

Hey Simon, unfortunately, not currently. The current state of the Tableau REST API doesn't allow for specifying any specific sheet (or all sheets) when exporting data from a Dashboard view. As you've noted, it always returns the data from the first sheet on the dashboard.

The general guidance here is to export the data from each sheet directly instead of from the dashboard on which it exists.

Is this a reasonable workaround for you? Happy to share this feedback with the appropriate owners of the REST API.

anyoung-tableau avatar Jan 04 '23 18:01 anyoung-tableau

Hey Simon, unfortunately, not currently. The current state of the Tableau REST API doesn't allow for specifying any specific sheet (or all sheets) when exporting data from a Dashboard view. As you've noted, it always returns the data from the first sheet on the dashboard.

The general guidance here is to export the data from each sheet directly instead of from the dashboard on which it exists.

Is this a reasonable workaround for you? Happy to share this feedback with the appropriate owners of the REST API.

Is there a endpoint to query a specific sheet within a view? Thank you!

saadbahir avatar Jan 17 '23 19:01 saadbahir

going to close this as it is essentially the same request as #1132

jacalata avatar Feb 15 '23 06:02 jacalata