tableau / embedding-api-v3-guide

migration guide for moving to embedding api v3
MIT License
27 stars 9 forks source link

Implement a function in the Viz object to export Crosstab data #27

Closed florent-guinard closed 3 weeks ago

florent-guinard commented 2 years ago

We're leveraging the Embedding API to embed Vizs and programmatically retrieve the Viz information (filters, parameters, data, ...) and compare it to expected values.

The Embedding API exposes a Viz.displayDialogAsync function that displays an export dialog.

For the Crosstab export, this function displays a modal on top of the embedded Viz with a "Download" button. We can't interact with this "Download" button programatically as it is in an iframe (CORS issues). We don't have this issue with the "Export Data" dialog for example since it opens a new browser Window.

We'd like to have a "Viz.exportCrosstabAsync" function that would take an Excel/CSV parameter and automatically download the Crosstab data in the selected format, exactly like the exportImageAsync shortcut.

Nikita-Kolos commented 2 years ago

It would also be cool to add: 1) showExportPDFDialog 2) showExportCrossTabDialog 3) showExportDataDialog

Mrkbingham commented 1 year ago

Just discovered this is still a missing feature as of the 2022.4 release, and chiming in on this thread as I'd consider it a very notable missing feature that will significantly impact our plans to migrate to Embedding API.

V2 Feature

In the v2 JS API, the crosstab (csv) and Excel exports accept worksheetInDashboard as an argument in the function allowing you to specify which worksheet to export:

showExportCrossTabDialog(worksheetInDashboard)

Shows the Export Data dialog, which is currently a popup window. The worksheetInDashboard parameter is optional. If not specified, the currently active Worksheet is used. If there is no currently active Worksheet, the method throws an exception.

cf. https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_ref.htm#viz_class

V3 Gap

In the v3 embedding API, the only available option to export data via CSV or Excel is to use displayDialogAsync(dialogType: [TableauDialogType])

Display one of the export dialogs based on the dialogType parameter

cf. https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/viz.html#displaydialogasync & https://help.tableau.com/current/api/embedding_api/en-us/reference/enums/tableaudialogtype.html

This requires you to pass in "export-cross-tab". When using that method, it displays this export dialog that surfaces all the options to the user, and limits the ability to customize the export experience that we've built using the v2 API: image

Use Cases

We use the v2 method pretty widely across our app. The most common use-cases are:

  1. Creating a "hidden" export worksheet on a dashboard to allow for pre-defining columns and/or pre-aggregated data. This can help prevent exposure of granular information that needs to remain inaccessible to users (i.e. PII data) while still allowing for exported ad-hoc data analysis.
  2. Limiting the worksheets to improve the user-experience. In a lot of cases, for example using a worksheet on a dashboard as a dynamic data-driven title: it doesn't make sense to export this title-page, but the naming convention may indicate to users that there is valuable data on that worksheet. Instead of allowing users to export all worksheets, we can limit to a subset of worksheets that only contain relevant and usable data.
praveenksam commented 1 year ago

It is important to be able download a PDF/PowerPoint/Excel Crosstab without the Tableau dialog for a few reasons:

  1. Web Portal design: The Tableau dialog seems out of place in a custom web portal design
  2. White-labelling: This is an extension of the above point. Even though the Tableau logo is not on the dialog box the additional box breaks the flow but also highlights the presence of a different tool breaking the white-labelling possibility with Tableau.
  3. Custom PDF/Powerpoint download flows: Some customers want to limit the PDF/Powerpoint download options to specific sizes so showing the dialog makes that difficult.
  4. One click Excel downloads: Web developers I have worked with have preferred adding just one button to provide a one step download of data as Excel instead of having an intermediate dialog.
bcantoni commented 3 weeks ago

This gap was implemented in Embedding API release 3.6.0.