Skip to content

Commit 3346fce

Browse files
jorwoodsclaude
andcommitted
docs: add missing Workbooks methods to api-ref.md
Adds documentation for methods not previously documented: - populate_powerpoint (API 3.8) - create_extract / delete_extract - populate_permissions / update_permissions / delete_permission - populate_revisions / download_revision / delete_revision - schedule_extract_refresh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f4a1003 commit 3346fce

File tree

1 file changed

+330
-0
lines changed

1 file changed

+330
-0
lines changed

docs/api-ref.md

Lines changed: 330 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6618,4 +6618,334 @@ with open('./workbook_pdf.pdf', 'wb') as f:
66186618
<br>
66196619
<br>
66206620

6621+
#### workbooks.populate_powerpoint
6622+
6623+
```py
6624+
workbooks.populate_powerpoint(workbook_item, req_options=None)
6625+
```
6626+
6627+
Populates the PowerPoint content of the specified workbook.
6628+
6629+
This method retrieves the workbook as a PowerPoint (.pptx) file. After calling this method, the PowerPoint content is available through the workbook's `powerpoint` property.
6630+
6631+
REST API: [Download Workbook PowerPoint](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_workbooks_and_views.htm#download_workbook_powerpoint){:target="_blank"}
6632+
6633+
**Parameters**
6634+
6635+
Name | Description
6636+
:--- | :---
6637+
`workbook_item` | Specifies the workbook to populate.
6638+
`req_options` | (Optional) You can pass in request options to specify the maximum age of the PowerPoint content rendered on the server.
6639+
6640+
**Exceptions**
6641+
6642+
Error | Description
6643+
:--- | :---
6644+
`Workbook item missing ID` | Raises an error if the ID of the workbook is missing.
6645+
6646+
**Returns**
6647+
6648+
None. The PowerPoint content is added to the `workbook_item` and can be accessed by its `powerpoint` field.
6649+
6650+
**Version**
6651+
6652+
Version 3.8 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6653+
6654+
**Example**
6655+
6656+
```py
6657+
server.workbooks.populate_powerpoint(workbook_item)
6658+
with open('./workbook.pptx', 'wb') as f:
6659+
f.write(workbook_item.powerpoint)
6660+
```
6661+
6662+
<br>
6663+
<br>
6664+
6665+
#### workbooks.create_extract
6666+
6667+
```py
6668+
workbooks.create_extract(workbook_item, encrypt=False, includeAll=True, datasources=None)
6669+
```
6670+
6671+
Creates extracts for the embedded data sources of the specified workbook.
6672+
6673+
**Parameters**
6674+
6675+
Name | Description
6676+
:--- | :---
6677+
`workbook_item` | The `WorkbookItem` to create extracts for.
6678+
`encrypt` | (Optional) Specifies whether to encrypt the extracts. The default is `False`.
6679+
`includeAll` | (Optional) Specifies whether to create extracts for all embedded data sources. The default is `True`. Set to `False` to specify individual data sources via the `datasources` parameter.
6680+
`datasources` | (Optional) A list of `DatasourceItem` objects representing the embedded data sources to create extracts for. Only used when `includeAll=False`.
6681+
6682+
**Returns**
6683+
6684+
Returns a `JobItem` for the extract creation job.
6685+
6686+
**Version**
6687+
6688+
Version 3.5 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6689+
6690+
**Example**
6691+
6692+
```py
6693+
workbook = server.workbooks.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
6694+
job = server.workbooks.create_extract(workbook, encrypt=True)
6695+
server.jobs.wait_for_job(job)
6696+
```
6697+
6698+
<br>
6699+
<br>
6700+
6701+
#### workbooks.delete_extract
6702+
6703+
```py
6704+
workbooks.delete_extract(workbook_item, includeAll=True, datasources=None)
6705+
```
6706+
6707+
Removes the extracts from the embedded data sources of the specified workbook.
6708+
6709+
**Parameters**
6710+
6711+
Name | Description
6712+
:--- | :---
6713+
`workbook_item` | The `WorkbookItem` to remove extracts from.
6714+
`includeAll` | (Optional) Specifies whether to remove extracts for all embedded data sources. The default is `True`. Set to `False` to specify individual data sources via the `datasources` parameter.
6715+
`datasources` | (Optional) A list of `DatasourceItem` objects representing the embedded data sources to remove extracts from. Only used when `includeAll=False`.
6716+
6717+
**Returns**
6718+
6719+
Returns a `JobItem` for the extract deletion job.
6720+
6721+
**Version**
6722+
6723+
Version 3.3 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6724+
6725+
**Example**
6726+
6727+
```py
6728+
workbook = server.workbooks.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
6729+
job = server.workbooks.delete_extract(workbook)
6730+
server.jobs.wait_for_job(job)
6731+
```
6732+
6733+
<br>
6734+
<br>
6735+
6736+
#### workbooks.populate_permissions
6737+
6738+
```py
6739+
workbooks.populate_permissions(workbook_item)
6740+
```
6741+
6742+
Populates the permissions for the specified workbook.
6743+
6744+
**Parameters**
6745+
6746+
Name | Description
6747+
:--- | :---
6748+
`workbook_item` | The `WorkbookItem` to populate with permissions.
6749+
6750+
**Version**
6751+
6752+
Version 2.0 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6753+
6754+
**Example**
6755+
6756+
```py
6757+
workbook = server.workbooks.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
6758+
server.workbooks.populate_permissions(workbook)
6759+
for permission in workbook.permissions:
6760+
print(permission.grantee_id, permission.capabilities)
6761+
```
6762+
6763+
<br>
6764+
<br>
6765+
6766+
#### workbooks.update_permissions
6767+
6768+
```py
6769+
workbooks.update_permissions(workbook_item, permission_item)
6770+
```
6771+
6772+
Adds or updates permissions for the specified workbook.
6773+
6774+
**Parameters**
6775+
6776+
Name | Description
6777+
:--- | :---
6778+
`workbook_item` | The `WorkbookItem` to update permissions for.
6779+
`permission_item` | A list of `PermissionsRule` objects representing the permissions to add or update.
6780+
6781+
**Version**
6782+
6783+
Version 2.0 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6784+
6785+
<br>
6786+
<br>
6787+
6788+
#### workbooks.delete_permission
6789+
6790+
```py
6791+
workbooks.delete_permission(workbook_item, capability_item)
6792+
```
6793+
6794+
Removes a permission from the specified workbook.
6795+
6796+
**Parameters**
6797+
6798+
Name | Description
6799+
:--- | :---
6800+
`workbook_item` | The `WorkbookItem` to remove the permission from.
6801+
`capability_item` | The `PermissionsRule` object representing the permission to remove.
6802+
6803+
**Version**
6804+
6805+
Version 2.0 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6806+
6807+
<br>
6808+
<br>
6809+
6810+
#### workbooks.populate_revisions
6811+
6812+
```py
6813+
workbooks.populate_revisions(workbook_item)
6814+
```
6815+
6816+
Populates the revision history for the specified workbook.
6817+
6818+
**Parameters**
6819+
6820+
Name | Description
6821+
:--- | :---
6822+
`workbook_item` | The `WorkbookItem` to populate with revision history.
6823+
6824+
**Exceptions**
6825+
6826+
Error | Description
6827+
:--- | :---
6828+
`Workbook item missing ID. Workbook must be retrieved from server first.` | Raises an exception if the `workbook_item` does not have an id.
6829+
6830+
**Version**
6831+
6832+
Version 2.3 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6833+
6834+
**Example**
6835+
6836+
```py
6837+
workbook = server.workbooks.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
6838+
server.workbooks.populate_revisions(workbook)
6839+
for revision in workbook.revisions:
6840+
print(revision.revision_number, revision.created_at)
6841+
```
6842+
6843+
<br>
6844+
<br>
6845+
6846+
#### workbooks.download_revision
6847+
6848+
```py
6849+
workbooks.download_revision(workbook_id, revision_number, filepath=None, include_extract=True)
6850+
```
6851+
6852+
Downloads a specific revision of the specified workbook.
6853+
6854+
**Parameters**
6855+
6856+
Name | Description
6857+
:--- | :---
6858+
`workbook_id` | The identifier (`id`) for the `WorkbookItem`.
6859+
`revision_number` | The revision number to download. Pass `None` to download the current (latest) revision.
6860+
`filepath` | (Optional) Downloads the file to the location you specify. If no location is specified (the default is `filepath=None`), the file is downloaded to the current working directory.
6861+
`include_extract` | (Optional) Specifies whether to download the file with the extract. The default is `True`.
6862+
6863+
**Exceptions**
6864+
6865+
Error | Description
6866+
:--- | :---
6867+
`Workbook ID undefined` | Raises an exception if a valid `workbook_id` is not provided.
6868+
6869+
**Returns**
6870+
6871+
The file path to the downloaded workbook revision.
6872+
6873+
**Version**
6874+
6875+
Version 2.3 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6876+
6877+
**Example**
6878+
6879+
```py
6880+
file_path = server.workbooks.download_revision(
6881+
'1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b',
6882+
revision_number='2'
6883+
)
6884+
print("\nDownloaded revision to {0}.".format(file_path))
6885+
```
6886+
6887+
<br>
6888+
<br>
6889+
6890+
#### workbooks.delete_revision
6891+
6892+
```py
6893+
workbooks.delete_revision(workbook_id, revision_number)
6894+
```
6895+
6896+
Removes a specific revision of the specified workbook from Tableau Server.
6897+
6898+
**Parameters**
6899+
6900+
Name | Description
6901+
:--- | :---
6902+
`workbook_id` | The identifier (`id`) for the `WorkbookItem`.
6903+
`revision_number` | The revision number to delete.
6904+
6905+
**Version**
6906+
6907+
Version 2.3 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6908+
6909+
**Example**
6910+
6911+
```py
6912+
server.workbooks.delete_revision('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b', '2')
6913+
```
6914+
6915+
<br>
6916+
<br>
6917+
6918+
#### workbooks.schedule_extract_refresh
6919+
6920+
```py
6921+
workbooks.schedule_extract_refresh(schedule_id, item)
6922+
```
6923+
6924+
Convenience method to add a workbook to an existing extract refresh schedule.
6925+
6926+
**Parameters**
6927+
6928+
Name | Description
6929+
:--- | :---
6930+
`schedule_id` | The identifier of the schedule to add the workbook to.
6931+
`item` | The `WorkbookItem` to add to the schedule.
6932+
6933+
**Returns**
6934+
6935+
Returns a list of `AddResponse` objects.
6936+
6937+
**Version**
6938+
6939+
Version 2.8 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
6940+
6941+
**Example**
6942+
6943+
```py
6944+
workbook = server.workbooks.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
6945+
result = server.workbooks.schedule_extract_refresh('schedule-id-here', workbook)
6946+
```
6947+
6948+
<br>
6949+
<br>
6950+
66216951

0 commit comments

Comments
 (0)