Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions 28 tableaudocumentapi/workbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class Workbook(object):

def __init__(self, filename):
"""Open the workbook at `filename`. This will handle packaged and unpacked
workbook files automatically. This will also parse Data Sources and Worksheets
workbook files automatically. This will also parse Data Sources, Worksheets and Dashboards
for access.

"""

self._filename = filename
Expand All @@ -30,6 +30,10 @@ def __init__(self, filename):
self._workbookRoot, self._datasource_index
)

self._dashboards = self._prepare_dashboards(
self._workbookRoot
)

@property
def datasources(self):
return self._datasources
Expand All @@ -42,6 +46,10 @@ def worksheets(self):
def filename(self):
return self._filename

@property
def dashboards(self):
return self._dashboards

def save(self):
"""
Call finalization code and save file.
Expand Down Expand Up @@ -116,3 +124,19 @@ def _prepare_worksheets(xml_root, ds_index):
datasource.fields[column_name].add_used_in(worksheet_name)

return worksheets

@staticmethod
def _prepare_dashboards(xml_root):

dashboards = []
dashboard_elements = xml_root.findall('.//dashboards/dashboard')

if dashboard_elements is None:
return dashboards

for dashboard_element in dashboard_elements:
dashboard_name = dashboard_element.attrib['name']
dashboards.append(dashboard_name)
return dashboards


Morty Proxy This is a proxified and sanitized view of the page, visit original site.