While I don't know how you would automate such a task, there shouldn't be any issue with exporting a packaged workbook then sending it to your users so they can use reader. Sorry if i'm not FULLY grasping what you're trying to do.
Here is what I am trying:
I will create few reports on the desktop and create a twbx package,
Then I will copy these packages to few client machines.
1 - I want to be able to open these reports with the reader and curious if the reader can be embedded into our .NET app, or can be opened in a frame from our app.
2- I want to be able to send new data to these clients rather than a package. So maybe unzip twbx and replace extract in there. How about using a local file on the client as data connection (maybe an access or excel file) and rewrite this file?
Bottom line, I want this process to be as dynamic as possible without a human interaction of copying, moving, opening, etc.
1. Tableau Reader cannot connect to live data sources, only packaged.
2. A Tableau Packaged Workbook is effectively a zip file. Open one up in winzip (or another zip tool) and you'll notice there is a data directory. You could write a program to unzip, insert data extract, rezip.
3. As far as I know there are no .NET / Windows controls to embed Tableau into an existing Winforms application. If you want to embed it within a webapp, you have a number of options but you would need a Tableau Server.
If you are in a situation where you need to have the workbook repackaged, how do you do that? We've been able to script the unpackaging and the updating, but the repackaged file doesn't seem to be recognized by the server.
ANY insight to this would be amazing.
Take the temporary folder structure and zip it then rename the extension to .twb or .twbx depending on the type of workbook it was originally.
I really appreciate the quick reply, this really helped up figure out how to correctly script our loading process. I'm also learning python as we go, so it's been an adventure.
Thank you again!!!
I am also looking for solution of same problem definition, in order to send .twbx file to user machines using Python.
Could you please post the solution if you have.
Are you trying to dynamically generate a TWBX or send a TWBX to a user through Python? The two are very different things.
If you're looking to generate a TWBX dynamically, you should rename your .twbx file to .zip, extract the contents and you can do whatever you want with those in Python to dynamically create or adjust a workbook file. The structure / definition of the workbook file is just XML so no special code needed to read and parse that.
Thank you for quick response.
My workflow would have below steps -
1) Copy & paste saved template workbook into new folder (Python)
2) Change data source dynamically in pasted workbook (Python)
3) Save updated workbook with new data source as .twbx into new folder (Python)
4) Send saved .twbx to user machine (TBD)
I already tried saving .twb with .twbx after changing data source but new file was not usable as gets open with error.
Thank you once again.
You cannot just rename a TWB to TWBX. You would need to zip the TWB file and rename the zip as TWBX.
To validate you are doing things correctly, as a test you should export a workbook as TWBX from Tableau, rename it to zip and unzip it. Take a look at the folder structure. This is exactly the same folder structure you need to replicate out of Python.
Appreciate your response Tom.
You can create workbooks programmatically (dynamically) since workbooks are really XML. I've done this and shared about it here: https://www.linkedin.com/pulse/create-tableau-visualizations-programmatically-allan-thompson
I used Python and the Pandas and Jinja2 libraries to create the TWB file and then to package it and the data into a TWBX file.
If you want to embed your visualization into an application, as far as I know, you need Tableau server.
With your workbook on Tableau server, you now have access to the embed code that you can plug into any HTML or .NET WebBrowser control, if that's what you're trying to do. You can also use the control from Tableau server to embed the authoring view into IE or a .NET desktop application. The authoring view gives users similar capabilities as Tableau Desktop.
To publish to Tableau server, you can use the RESTful API that Tableau provides. They provide code examples for using the API with either Java or Python.
Summary: it is possible to manage the creation and publishing of workbooks on behalf of a user from beginning to end and give users access to view and interact with those workbooks within your custom app.
Thanks for sharing this detail about the license agreement for Reader. I think generating and updating workbooks programmatically makes the most sense when the intent is to publish to Tableau server.