Automatically export Dataset from Domo

Hello Domo comunity, 

 

We are looking for automatic dataset export from Domo to email. Is there an easy way to do that on a daily basis and what would be your suggestion to do that?

Thank you in advance!

Comments

  • I would recommend using the API to do this, it will require the following.

     

    1: Script that pulls down the data of a specific dataset into a CSV (all doable with the API/SDK. I've done this in Python).

    2: Once the file is downloaded the script would send it via email

    3: A way to run the script on a schedule so that you can have it run daily.

     

    This seems to me to be the most basic way you can do this. You would be able to re-use almost all the code for any dataset you want to do this for, you would just swap out the dataset ID to get different datasets.

     

    Here is some example Python code from a script I made to do this, it'll get you started (if you do it in Python)

     

    import json
    import requests
    import datetime

    # Base64 version of combined id+secret
    base64auth = {InsertYourBase64Auth}
    api_host = 'api.domo.com'

    # Get token from Domo
    token = requests.get('https://api.domo.com/oauth/token?grant_type=client_credentials&scope=audit data', headers={'Authorization': 'Basic ' + base64auth})
    token = json.loads(token.text)
    token = token['access_token']

    dataset_id ={EnterYourDatasetId}
    csv_file_path = 'C:\\Users\\{UserAccount}\\PycharmProjects\\DomoScripts\\files\\jira-data.csv'

    # GET request for the dataset list data
    dataset_endpoint = "https://api.domo.com/v1/datasets/"+ dataset_id + "/data?includeHeader=true&fileName=jira-data.csv"
    dataset_response = requests.get(dataset_endpoint, headers={'Accept': 'text/csv','Authorization': 'bearer ' + token})


    with open(csv_file_path,'wb') as csv_file:
    for chunk in dataset_response.iter_content(chunk_size=1024):
    if chunk:
    csv_file.write(chunk)
    csv_file.close()

     



    **Make sure to like any users posts that helped you and accept the ones who solved your issue.**
  • This is not helpful because the card is a pivot table, and I don't think a CSV would keep the pivot, and certainly would not keep the conditional formatting.

    It is maddening that the reports and publish only do a jpg of what fits on one page, while the export to xls is exactly the format I would like to send out as an automated report.