Skip to main content

Trying to create tabpy in my Tableau Desktop.

Installed Anaconda.

Created a virtual environment 

Installed tabpy

installed tableau-api-lib

I am trying to execute the below python code using Visual code and seeing the below error message.

module not found.

Using the below Python Code.

from tableau_api_lib import TableauServerConnection

from tableau_api_lib.utils.querying import get_projects_dataframe

 

# Set your Tableau Server credentials and URL

server_url = "<URL>"

username = "ser-tableau"

password = "XXXX"

 

# Create a Tableau Server connection

with TableauServerConnection(server_url, username, password) as tableau_auth:

  # Replace 'your-project' and 'existing-workbook-name' with the project and workbook you want to work with

  project_name = 'Default'

  workbook_name = 'Entitlements_All.hyper'

 

  # Find the project ID

  all_projects, pagination_item = get_projects_dataframe(tableau_auth)

  project_id = all_projects.loc[all_projects['name'] == project_name, 'id'].values[0]

 

  # Find the workbook ID

  all_workbooks, pagination_item = tableau_auth.workbooks.get()

  workbook_id = all_workbooks.loc[all_workbooks['name'] == workbook_name, 'id'].values[0]

 

  # Specify the path to the new workbook file

  new_workbook_path = 'X/Entitlements_Finance_Tech.hyper'

 

  # Replace the existing workbook with the new one

  tableau_auth.workbooks.update_from_path(new_workbook_path, workbook_id, project_id)

  print(f"Workbook '{workbook_name}' has been replaced with the new workbook.")

2 réponses
  1. 5 oct. 2023, 19:45

    @Chris McClellan​ Output file generates by using multiple flows with Append feature. I am appending years from 2017 to till 2023 to one file. To avoid timeout issues i am appending year by year to one file. Now i want to lift and shift this file to other folder where my production file is there.