1

i would like to preload(refresh) tableau public workbook (sheet) in background with python API everyday , in order to load data (connect live) into tableau as a cache for user opening it faster (because some workbooks load lot time), below is my code and the result is can't refresh workbook, is something wrong with my code ? is any way to achieve my goal?

import tableauserverclient as TSC

tableau_auth = TSC.TableauAuth('username', 'password')
server = TSC.Server('http://my.server', use_server_version=True)
with server.auth.sign_in(tableau_auth):   
    all_workbooks_items, pagination_item = server.workbooks.get()
    for workbook in all_workbooks_items:     
            if 1:  
                try:  
                    response = server.workbooks.refresh(workbook.id)
                    print("\nThe data of workbook {0} is refreshed.".format(workbook.name))
                except Exception as e:  
                    response = e  
            else:  
                response = "Refresh was not requested"              
            print(workbook.name, str(response).replace("    ","").strip());

and the result is below:

mytestworkbook1 403104: Forbidden Workbook 'fs45d21f-6526-41c8-a5de-83f98cd40128' contains no extracts and cannot be refreshed.

mytestworkbook2 403104: Forbidden Workbook 'fs4f09a3-e435-4c1a-ad4a-2069faa47281f' contains no extracts and cannot be refreshed.

mytestworkbook3 403104: Forbidden Workbook 'wr66f064-f0dc-4c77-bd87-be249f06fk27' contains no extracts and cannot be refreshed.

Naturehigh
  • 21
  • 4

0 Answers0