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, 2022 in Tableau by Vaani
• 7,070 points
1,040 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."

Elevate your data visualization skills with our Tableau Course and unleash the power of insightful analytics.

answered Apr 5, 2022 by Neha
• 9,020 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
1,175 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,240 points
965 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 ffdfd
• 5,550 points
5,974 views
0 votes
1 answer

Error while connecting tableau to snowflake using username and password

"Couldn't resolve host name," says the error ...READ MORE

answered Mar 3, 2022 in Tableau by Vaani
• 7,070 points
830 views
0 votes
1 answer

How do I add a custom login and logout page in my Tableau Server on-prem?

I don't believe it is "officially" possible ...READ MORE

answered Mar 4, 2022 in Tableau by Neha
• 9,020 points
756 views
0 votes
0 answers

Tableau layout for multiple charts on one worksheet

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

Mar 10, 2022 in Tableau by Neha
• 9,020 points
438 views
0 votes
0 answers

Tableau report sharing

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

Mar 22, 2022 in Tableau by Vaani
• 7,070 points
416 views
0 votes
1 answer

Tableau download/export images using Rest api python

The easiest method is to send an ...READ MORE

answered Apr 5, 2022 in Tableau by Neha
• 9,020 points
1,117 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, 2022 in Tableau by Neha
• 9,020 points
875 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP