Download data in Viewer¶
Download data displayed in a widget¶
In the configuration of a widget, in the Export section, you can enable download in CSV or XLS file of the widget data. This will only download the content of the chart or the table where it is activated.
For a table (or any other chart), there is a maximum of 20.000 rows displayed and available for download.
Download all the rows from a datasource¶
If you're an admin, the best option is to open the datasource configuration and to click on the button "Download data as CVS File". But a dashboard viewer does not have access to this part of the software. Still, there is an option to add a button in a dashboard that will allow him to download the full data of a datasource.
As a first step, you need to enable the option 'Allow full download in Viewer' on the datasource. This is a security constraint. By default, exporting the full data from a datasource by a Viewer is disabled.
srnDownloadSourceData in a dashboard. The
easiest way to do that is to create a KPI widget, select the source you want to download in its data configuration and
$$count$$ measure (this is only required to have a valid configuration for the widget). Then, in the rendering
section of the widget, choose the template Custom HTML and trigger the function
srnDownloadSourceData by a
set on one element. Here is a simple example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<!-- use flex to center the content--> <div style="display:flex; align-items:center; height:100%; justify-content:center"> <!-- button with the onclick triggering the CSV download--> <div style="font-size: 1.5vw; padding: 10px; margin: 10px; border: 1px solid #0099cc; color: #0099cc; border-radius: 4px; cursor:pointer; width: 80%; text-align: center" onclick=srnDownloadSourceData("2f6590f8-fdac-4ae7-b4de-e69fc2d8cb0c")> <span class="fa fa-download"></span> Download mydata </div> </div>