This documentation is for the unstable version of GoodData, currrently in development.
For stable version, go to the latest stable version of this article.

Dashboard Export

Create dashboard exports or automate your pipelines. Can be for example be used to report .pdf via e-mail each week.



from gooddata_sdk import GoodDataSdk
import schedule
import smtplib
from os.path import basename
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import COMMASPACE, formatdate

# GoodData base URL, e.g. ""
host = ""
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

def send_mail(send_from, send_to, subject, text, files, server):
   msg = MIMEMultipart()
   msg["From"] = send_from
   msg["To"] = send_to
   msg["Date"] = formatdate(localtime=True)
   msg["Subject"] = subject


   # Open CSV / XLSX file(s) and add it to email attachment
   for f in files or []:
       with open(f, "rb") as fil:
           part = MIMEApplication(
       part["Content-Disposition"] = "attachment; filename=\"%s\"" % basename(f)

   smtp = smtplib.SMTP(server)
   smtp.sendmail(send_from, send_to, msg.as_string())

def export_tabular():
    # Export a particular insight in the desired format (CSV / XLSX)
        workspace_id = "demo",
        insight_id = "revenue",
        file_format = "CSV",
        file_name = "revenue_export.csv"

        send_from = "",
        send_to = "",
        subject = "Scheduled export",
        text = "Scheduled export of dashboard 'dashboard_overview'",
        # Name of exported file from the method call 'export_pdf'
        files = "revenue_export.csv",
        server = "<your_smtp_server>"

# Schedule call to export visualization in CSV and sent via e-email every morning at 8:00.