8 Replies Latest reply on Feb 21, 2017 6:33 AM by Jose Alvarado

    download all twbx from a project using tabcmd

    kartic kumar

      I have 18 twbx files in one project on tableau server.. Using below code to download the file -

       

      tabcmd get "/workbooks/abc.twbx" -f "D:\tableauworkbook\abc.twbx"

       

      Have replicated the above line for 17 other twbx files as there names are different. The above code is executing fine

       

      I need a code where i can just pass the Project name in tabcmd & it downloads all the files present in one of the project  from tableau server with the same name they have it on local.

       

      Thanks in advance.

        • 1. Re: download all twbx from a project using tabcmd
          Luciano Vasconcelos

          Hi.

           

          I use to create a .bat file with parameters receiving as parameters project and datasource:

           

          cd D:\Program Files\Tableau\Tableau Server\9.2\bin

          tabcmd refreshextracts --server "xxxxxxxxxxxx" --no-certcheck --username "xxxxxxx" --password "xxxxxxxxxxx" --project %1 --datasource %2

          • 2. Re: download all twbx from a project using tabcmd
            kartic kumar

            Hi Lucas ,

             

            Thanks for the reply!!

             

            Not sure how your code will help me.

            I am running tabcmds through .bat file but the problem is file name keep changing which are located in the project.

             

            So to download the twbx file from server,  i have to edit the ,bat file with new file names everytime.
            Looking for any way where i just pass the project name in tmbcmd & all twbx files located on the Project on tableau server, get downloaded on my local system

            • 3. Re: download all twbx from a project using tabcmd
              Luciano Vasconcelos

              Well, you can use parameters in .bat to do it and just change how you call bat file.

               

              I call just one .bat file called by CONTROL-M to refresh my datasources.

              CONTROL-M input the parameters.

              • 4. Re: download all twbx from a project using tabcmd
                Jeff Strauss

                here's one method for fully automating.

                 

                1. create and publish a Tableau report that lists out all the workbooks for a given project.  The project can be a parameterized filter

                 

                2. Using tabcmd, do an export and pass in the parameter value of the project.  This will export the list of workbook names to a csv

                 

                3. Use a for loop to go through all the workbooks on the list and do a tabcmd get

                 

                 

                 

                See Tableau's data dictionary to see how to tap into the Tableau internal repository.

                Workgroup DatabaseData Dictionary

                1 of 1 people found this helpful
                • 5. Re: download all twbx from a project using tabcmd
                  kartic kumar

                  Hello Jeff,

                   

                  Thanks much for the post!!!

                   

                  I was able to create & publish a workbook on tableau server. The workbook gives the names of the twbx files present in one project .

                  Created batch file with tabcmd to export the data of the sheet into csv using tabcmd.

                   

                  tabcmd line used to get tableau sheet data into csv :

                  tabcmd get "/views/WorkBooks/Sheet1.csv?Select%%20Project=abc%%20def%%20ghi" -f "D:\Files\Sheet1.csv"

                  (1st step & 2nd step completed. Facing issue in 3 rd step)

                   

                   

                   

                   

                   

                  CSV file has data in below format.

                   

                   

                   

                   

                  Name

                  Workbook1 Country1

                  Workbook2 Country2

                  Workbook3 Country3

                  Workbook4 Country4

                  Workbook5 Country5

                   

                   

                  Now i am not able to create a batch file with tabcmd which parse the csv & use the csv data in tabcmd get.

                   

                   

                  Can you help me with the code for a batch file which parse csv data & use it in tabcmd get.

                   

                   

                   

                   

                  cd C:\Program Files\Tableau\Tableau Server\9.0\bin

                  tabcmd login -s localhost:XXXX -u tableau -p passowrd

                  tabcmd get "/workbooks/Workbook1Country1.twbx" -f "D:\Ashika\Workbook1 Country1.twbx"

                  tabcmd logout

                   

                   

                   

                   

                  Also in above code, i have to remove the blanks from twbx file name ie Workbook1 Country1.twbx has to be Workbook1Country1 before executing above command.

                  • 6. Re: download all twbx from a project using tabcmd
                    Jeff Strauss

                    lol.  You don't really have to parse the csv if you use the proper tabcmd export.

                     

                    tabcmd export "/workbookname/viewname?ParmProject=xxxxx&:refresh=yes" -f "g:\trythis.csv" --csv

                     

                     

                    Once you export the data, then you can loop through it with something like this.  It skips the first line, and it assumes you have 2 fields in your CSV, workbook name and workbook URL

                     

                    REM %%A - Workbook name

                    REM %%B - Workbook URL

                    for /F "skip=1 tokens=1-2 delims=," %%A in (g:\trythis.csv) DO (

                        tabcmd get %%B.twbx?:refresh=yes --filename "g:\path_workbook_capture\%%A.twbx"

                    )

                    1 of 1 people found this helpful
                    • 7. Re: download all twbx from a project using tabcmd
                      kartic kumar

                      Worked !!! Thank much Jeff for the help

                       

                      added ""/workbooks/     "in tabcmd to get the result.

                       

                      REM %%A - Name

                      REM %%B - Workbook Url

                      for /F "skip=1 tokens=1-2 delims=," %%A in (g:\trythis.csv) DO (

                          tabcmd get "/workbooks/%%B.twbx?:refresh=yes" --filename "g:\path_workbook_capture\%%A.twbx"

                      )

                      Also could you please let me know which is the language which you have used like REM %%A or for /F "skip=1 tokens=1-2 delims=

                      1 of 1 people found this helpful
                      • 8. Re: download all twbx from a project using tabcmd
                        Jose Alvarado

                        How to download a workbook from a single project in tableau server with command lines?