Zuar Runner Job: Export

Introduction

This document describes how to use the Export job; it is intended to replace the Tableau Export job.

The Tableau Export job was introduced to Zuar Runner in early 2019. It allows Zuar Runner users to create Zuar Runner jobs that use the the Tableau cli command tabcmd to create reports in PDF, CSV, and PNG formats, and to email those reports to distribution lists.

To support the new Subscriptions job being added to Zuar Runner in release 2.7.8, it was necessary to allow the creation of similar reports while impersonating the Tableau user id of arbitrary users. That ability is not present in tabcmd, so another means of creating reports was necessary. The Export job performs exports using either the Tableau Vizql API (PDF exports) or the Tableau REST API (CSV, XLSX exports), both of which support user impersonation.

Beginning in 2.7.8, any new jobs that are created to generate and email reports should use the Export job. To avoid breaking existing jobs with the new release, the Tableau Export job remains in Zuar Runner, though it should be considered deprecated.

Configuration

Reference: Export job configuration

Use the Generic Job Wizard to create a new generic job. Change the type of the job created by the wizard to export.

Example CSV Configuration

The following job will export all views in the Superstore workbook as csv files and place all files in a single ZIP archive. The export will be saved in /var/mitto/data/example-csv.zip.

{
    /* Tableau server credentials (named credentials supported) */
    "credentials": {
        "username": "<username>"
        "password": "<password>"
    },
    /* Tableau server configuration */
    "server": {
        "server": "https://tableau.zuar.com",
        "site": "",
        "user_id_to_impersonate": "5cf3542a-0c46-42fb-b6a5-27a96e41054a",
    },
    "export": {
        "full": true,
        "name": "example-csv",
        "type": "csv",
        "view_filters": {
            "State": ["Louisiana", "Texas"],
            "Category": ["Office Supplies", "Furniture"]
        },
        "view": "Overview",
        "workbook": "Superstore"
    }
}

To export just the Overview view, change full to false. The export will be saved as /var/mitto/data/example-csv.csv.

Example XLSX Configuration

The following job will export all views in the Superstore workbook and save each view as a sheet in an Excel workbook. The export will be saved in /var/mitto/data/example-excel.xlsx.

{
    /* Tableau server credentials (named credentials supported) */
    "credentials": {
        "username": "<username>"
        "password": "<password>"
    },
    /* Tableau server configuration */
    "server": {
        "server": "https://tableau.zuar.com",
        "site": "",
        "user_id_to_impersonate": "5cf3542a-0c46-42fb-b6a5-27a96e41054a",
    },
    "export": {
        "full": true,
        "name": "example-excel",
        "type": "xlsx",
        "view_filters": {
            "State": ["Louisiana", "Texas"],
            "Category": ["Office Supplies", "Furniture"]
        },
        "view": "Overview",
        "workbook": "Superstore"
    }
}

To export just the Overview view, change full to false. The export will be saved as /var/mitto/data/example-excel.xlsx.

Example PDF Configuration

The following job will export all views in the Superstore workbook and save each view as one or more pages in the resulting PDF file. The export will be saved in /var/mitto/data/example-pdf.pdf.

{
    /* Tableau server credentials (named credentials supported) */
    "credentials": {
        "username": "<username>"
        "password": "<password>"
    },
    /* Tableau server configuration */
    "server": {
        "server": "https://tableau.zuar.com",
        "site": "",
        "user_id_to_impersonate": "5cf3542a-0c46-42fb-b6a5-27a96e41054a",
    },
    "export": {
        "full": true,
        "modifications": [
            {
                "action": "update",
                "destination": "files",
                "items": {
                    "clientDimension": "{\"w\": 1280, \"h\": 1024}",
                    "dashboardPortSize": "{\"w\": 1280, \"h\": 1024}",
                    "worksheetPortSize": "{\"w\": 1280, \"h\": 1024}"
                },
                "request": "bootstrap"
            }
        ],
        "name": "example-pdf",
        "options": {
            "imageHeight": "0",
            "imageWidth": "0",
            "pageFitHorizontal": "1",
            "pageFitVertical": "1",
            "pageOrientationOption": "landscape",
            "pageScaleMode": "auto",
            "pageScalePercent": "100",
            "pageSizeOption": "letter"
        },
        "type": "pdf",
        "view_filters": {
            "State": ["Louisiana", "Texas"],
            "Category": ["Office Supplies"]
        },
        "view": "Overview",
        "workbook": "Superstore"
    }
}

To export just the Overview view, change full to false. The export will be saved as /var/mitto/data/example-pdf.pdf.