Download workbooks twb tbwx in local from Tableau online API

0 votes

I'm trying to use a Powershell script to get my workbooks from the Tableau Rest API. The following techniques are described in the documentation:

https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#download_workbook

I've used the API to acquire users and groups before, but I'm having difficulties downloading them. I created a script that allows me to sign in and list workbooks (it works), but I'm not sure how the file must be downloaded; my script doesn't give me an error when I execute it:

$response = Invoke-RestMethod -Uri https://dub01.online.tableau.com/api/3.11/sites/$siteID/workbooks -Headers $headers -Method Get
$Nbtwbx = $response.tsResponse.pagination.totalAvailable

For($i=0;$i -lt $Nbtwbx;$i++) 
{ 
    $WbId = $response.tsResponse.Workbooks.workbook[$i].id
    $Workbook = $response.tsResponse.Workbooks.workbook[$i].name
    $Folder = $response.tsResponse.Workbooks.workbook[$i].project.name
    $DownloadQuery = Invoke-RestMethod -Uri https://dub01.online.tableau.com/api/3.11/sites/$siteID/workbooks/$WbId/content?includeExtract=false -Headers $headers -Method Get 
}

Mar 31 in Tableau by Vaani
• 7,020 points
89 views

1 answer to this question.

0 votes
Tableau's reaction may be seen below. It appears to be operating properly:

"After examining our documentation on commands that download workbooks both within Rest API and outside of it (tabcmd), I discovered that whether the workbook is downloaded as a.twb or a.twbx is determined by the data source for the workbook, not the IncludeExtract option." This behaviour is by design, which I realise might cause confusion when using the IncludeExtract argument, which I was able to validate with our devs.

The format in which a workbook is downloaded is determined by the data connection: live and published connections download as.twb, whereas all workbooks with extract connections download as.twbx. When the IncludeExtract=false option is used, the.tbwx package is replaced with a.tds/.tdsx file, which is a Tableau Data Source file.

While our developers claim that this behaviour is by design, there is a solution in the form of extracting the packed workbook file. When a.twbx file is extracted, it is divided into two files:.twb and.tds/.tdsx.

One of two methods can be used to accomplish this:

- If you have Tableau Desktop installed on your computer, you can simply right-click the.twbx file and choose "Unpackage."

- If Tableau is not installed on the PC, rename the file and convert the.twbx extension to.zip, which can then be unpacked/unzipped using any compression programme such as WinZip, SevenZip, and so on."
answered Apr 5 by Neha
• 8,920 points

Related Questions In Tableau

+2 votes
1 answer
0 votes
1 answer

Not able to publish workbook in Tableau Server after upgrading it from Tableau 9.1 to 9.2

Following is a little hack that will ...READ MORE

answered Jun 19, 2018 in Tableau by xyz
• 1,560 points
524 views
0 votes
1 answer

How can I remove { } from columns in Tableau?

Create the following calculated field and use ...READ MORE

answered Aug 10, 2018 in Tableau by Atul
• 10,230 points
400 views
0 votes
1 answer

Aggregating from multiple columns in Tableau

You can use Tableau’s inbuilt pivot method ...READ MORE

answered Aug 18, 2018 in Tableau by sdfg
• 5,550 points
4,834 views
0 votes
1 answer
0 votes
1 answer
0 votes
0 answers

Tableau layout for multiple charts on one worksheet

On one spreadsheet, I have 15 pie ...READ MORE

Mar 10 in Tableau by Neha
• 8,920 points
41 views
0 votes
0 answers

Tableau report sharing

We have a number of historical tableau ...READ MORE

Mar 22 in Tableau by Vaani
• 7,020 points
30 views
0 votes
1 answer

Tableau does not import all the dates in column from csv file

Is it feasible to convert the csv ...READ MORE

answered Apr 5 in Tableau by Neha
• 8,920 points
115 views
0 votes
1 answer

Extract Last Value as Metric from Table Calculation in Tableau?

First, a quick introduction to table calculations, ...READ MORE

answered Apr 12 in Tableau by Neha
• 8,920 points
150 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP