2 Replies Latest reply on Sep 5, 2018 9:41 PM by Milan Das

    Export Tableau Dashboard to SharePoint with tabcmd

    Milan Das

      HI All,

       

      Need your help to achieve below requirement

      Requirement is to export tableau report as a pdf format using tabcmd command.

       

      This is the batch script i am using to generate pdf.

       

      @echo off

       

      CD C:\Program Files\Tableau\Tableau Server\2018.1\bin

       

      tabcmd login -s *********  -u ***** -p **********

       

      for /f "tokens=*" %%a in (D:\sample.txt) do call :processline %%a

      pause

      goto :eof

      :processline

      echo Creating PDF for Test %*

      tabcmd export "DemoPdFGENERATION/LargeSite --fullpdf -f "net use * \\sharepoint.com\sites\aurora\Documents\%*"

      goto :eof

       

      :eof

       

       

      Output is :

      *** Invalid file path 'net use * \\sharepoint.com\sites\aurora\Documents

       

      Note :-Network drive is not installed in my VM .

       

      Thanks In Advance !!!!

        • 1. Re: Export Tableau Dashboard to SharePoint with tabcmd
          Carisa Chang

          Hi Milan,

           

          You'll need to save to a network drive or local drive that this user has access to write. I've not seen a path written like this one before, I'd recommend mapping this SharePoint site to a network drive and then saving to that path.

          • 2. Re: Export Tableau Dashboard to SharePoint with tabcmd
            Milan Das

            Thanks for your response .

            Below is the powershell script to move file from local drive to Sharepoint.but  getting error saying

            $User = "usrname"

            $SiteURL = "sharepoint url?

            $Folder = "Local path to upload file"

            $DocLibName = "TableauPOC"

             

             

            #Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM

            Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"

            Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

            $Password = Read-Host -Prompt "Please enter your password" -AsSecureString

             

             

            #Bind to site collection

            $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)

            $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)

            $Context.Credentials = $Creds

             

             

            #Retrieve list

            $List = $Context.Web.Lists.GetByTitle($DocLibName)

            $Context.Load($List)

            $Context.ExecuteQuery()

             

             

            #Upload file

            Foreach ($File in (dir $Folder))

            {

            $FileStream = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open)

            $FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation

            $FileCreationInfo.Overwrite = $true

            $FileCreationInfo.ContentStream = $FileStream

            $FileCreationInfo.URL = $File

            $Upload = $List.RootFolder.Files.Add($FileCreationInfo)

            $Context.Load($Upload)

            $Context.ExecuteQuery()

            }

             

            If you have any script or solution for this please let me know.

             

            Thanks

            Milan