Skip to main content

My code :

 

⌗sign in 

 

tableau_auth = TSC.TableauAuth(user, password)

server = TSC.Server(r'http://yourserver.com')

server.use_server_version()

   

with server.auth.sign_in(tableau_auth):

 

⌗csv file create with view_item.csv

all_workbooks, pagination_item = server.workbooks.get()

wfound = [workbook for workbook in all_workbooks if workbook.name == 'MyWorkbook']

wconnect = server.workbooks.get_by_id(wfound[0].id)

server.workbooks.populate_views(wconnect)

vfound = [view for view in wconnect.views if len(view.name) > 0]

view_item = vfound[0]

server.views.populate_csv(view_item)

with open('view_csv.csv','wb') as f:

  f.write(b''.join(view_item.csv))

 

⌗subscrptions

target = TSC.Target('view iid', 'workbook')

schedule_id = ''

user_id = ''

new_sub = TSC.SubscriptionItem('My Subscription', schedule_id, user_id, target)

⌗new_sub.attach_image = False

⌗new_sub.attach_pdf = True

new_sub.message = "You have an alert!"

⌗new_sub.page_orientation = TSC.PDFRequestOptions.Orientation.Landscape

⌗new_sub.page_size_option = TSC.PDFRequestOptions.PageType.B4

new_sub.send_if_view_empty = True

new_sub = server.subscriptions.create(new_sub)

print(new_sub.subject)

 

Any idea on thisHow to attach the file in subsciption part.

So user recieve an CSV report(view_item..csv) as well.

Also is there any way i can name the report same as workbook name

@Chris McClellan

12 个回答
  1. 2022年3月31日 06:32

    You can't attach a file to a subscription, you would have to email it as a separate file to them.

     

    I'd be worried what you're doing though, it feels like you're turning Tableau into an ETL tool - why not source the data from the same place that Tableau does ?

0/9000