Python Script to Export Dashboards to CSV File
The following Python script allows exporting dashboard data to CSV files.
The script will export each widget to a separate CSV file.
✨This new version of the script uses Sisense's REST API an eliminates the direct connection to the mongodb.
Important: Starting with Sisense V8.0.1The GET /dashboards/{id} endpoint returns only the Dashboard Owner ID and no other information about dashboard owners when called by non-Admin users (see Sisense Release Notes.)
Therefore the user used to run this scrip must have admin rights for the script to work properly.
Download
exportDashboardToCSV_01272020.zip - contains the script executable and configuration file and does not require Python installation on the server.
Settings
The script uses a settings.yaml file. You should configure the following settings:
Setting
|
Description
|
---|---|
email
|
Admin email address.
If you're using the api token to authenticate leave this value blank.
|
password
|
Admin password.
If you're using the api token to authenticate leave this value blank.
|
api_token
|
The API token can be use instead of the password.
To retrieve you API token use the
POST /authentication/login REST API command.
See here for more info.
Note: The admin email and password are used for retrieving the API token.
The token is required for running API command.
See the REST API documentation for more information.
|
file_logLevel
|
Log level for the log file. Available options:
DEBUG
INFO
WARNING
ERROR
CRITICAL
|
console_logLevel
|
Log level for the console. Available options:
DEBUG
INFO
WARNING
ERROR
CRITICAL
|
logFileName
|
Path to the script log file.
|
protocol
|
Protocol for accessing Sisense http or https.
Default: http
|
verify
|
Set verify to False toignore verifying the SSL certificate.
Default: true
|
port
|
Sisense port.
Default 8081
|
host
|
Sisense host.
Default: localhost
|
csvFilePath
|
CSV files output directory
|
csvFileNameConvention
|
Naming convention for the generated CSV files.
Options are:
WIDGET_NAME (e.g. Total csv)
WIDGET_AND_DASHBOARD_NAME (e.g. Total Revenue_Sales Dashboard.csv)
WIDGET_AND_DASHBOARD_ID (e.g. 5783b9eb25ddaf78420000a6_56f1aa1dbc4b62043a000028.csv)
|
Usage
exportDashboardToCSV.exe [-h] [-dashboards [DASHBOARDS ...]]
[-widgets [WIDGETS ...]]
optional arguments:
-h, --help show this help message and exit
-dashboards DASHBOARDS [DASHBOARDS ...] List of dashboard IDs to export separated by space.
-widgets WIDGETS [WIDGETS ...] List of widget IDs to export separated by space.
Each widget ID should be in the format of <dashboard id>.<widget id>
-dashboards DASHBOARDS [DASHBOARDS ...] List of dashboard IDs to export separated by space.
-widgets WIDGETS [WIDGETS ...] List of widget IDs to export separated by space.
Each widget ID should be in the format of <dashboard id>.<widget id>
Output
The script will create an output directory 'csv' in the scripts directory.
Each widget in the dashboard will be exported to a separate CSV file named as: dashboardID_widgetID.csv
Examples
Export an entire dashboard:
exportDashboardToCSV.exe -dashboards 5e2a1bccbc60327e98fb4635
Export multiple dashboards:
exportDashboardToCSV.exe -dashboards 5e30922fa9ab7536081a6ee9 5e3087a78d9e7f0e3cb3e6f8
Export individual widget:
exportDashboardToCSV.exe -widgets 5e3087a78d9e7f0e3cb3e6f8.5e3087a78d9e7f0e3cb3e6f9
Export multiple widgets:
exportDashboardToCSV.exe -widgets 5e3087a78d9e7f0e3cb3e6f8.5e3087a78d9e7f0e3cb3e6f95e3087a78d9e7f0e3cb3e6f8.5e3087a78d9e7f0e3cb3e6f9
Export a combination of dashboards and widgets:
exportDashboardToCSV.exe -dashboards 5e30922fa9ab7536081a6ee9 5e3087a78d9e7f0e3cb3e6f8 -widgets 5e3087a78d9e7f0e3cb3e6f8.5e3087a78d9e7f0e3cb3e6f9 5e3087a78d9e7f0e3cb3e6f8.5e3087a78d9e7f0e3cb3e6f9
Updated 02-15-2024
intapiuser
Admin
Joined December 15, 2022