Closed florent-guinard closed 3 weeks ago
It would also be cool to add: 1) showExportPDFDialog 2) showExportCrossTabDialog 3) showExportDataDialog
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.
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
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:
We use the v2 method pretty widely across our app. The most common use-cases are:
It is important to be able download a PDF/PowerPoint/Excel Crosstab without the Tableau dialog for a few reasons:
This gap was implemented in Embedding API release 3.6.0.
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.