2 Replies Latest reply on Mar 28, 2019 10:09 AM by Ben Newell

    JavaScript API to get Underlying Data


      Russell Christopher @Daniel Alvarez Vera   I am trying to get the underlying data from one of the workbook which is in the dashboard.


      am using the below code . the same code work well when I publish this in the tableau public but not in in-house tableau server. I have switched different javascript but nothing helped me.


      1. I have tried below URL one by one  in the code and  the dashboard is rendering but when I click the Get Data button then am getting this error "0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'getUnderlyingDataAsync'"




      http://in-houseserver/javascripts/api/viz_v1.js  -( dashboard also not rendering)


      2. when I try the same dashboard published in the tableau public and I have used the below java script. the dashboard and underlying data works well



      could you guide me to resolve this issue?




      <!DOCTYPE html>





          <title>getData() Basic Example</title>

          <!--<script type="text/javascript" src="http://public.tableau.com/javascripts/api/tableau-2.min.js"></script>-->

              <!--<script type="text/javascript" src="http://in-houseserver/javascripts/api/tableau-2.0.0.js"></script>-->

      <script type="text/javascript" src="http://in-houseserver/javascripts/api/tableau_v8.js"></script>

          <!--<script type='text/javascript' src='http://in-houseserver/javascripts/api/viz_v1.js'></script>-->

          <!--<script src="scripts/tableau-2.min.js"></script>-->



          <script type="text/javascript">

              var viz, sheet, table;


              function initViz() {

                  var containerDiv = document.getElementById("vizContainer"),

                      //  url = "https://public.tableau.com/views/MyFirstDashboard_74/MyFirstDB",


                      url = "http://in-houseserver/views/MyFirstDashboard/MyFirstDB",


                      options = {

                          hideTabs: true,

                          hideToolbar: true,

                          onFirstInteractive: function() {

                              document.getElementById('getData').disabled = false; // Enable our button



                  viz = new tableau.Viz(containerDiv, url, options);




              function getUnderlyingData() {

                 // sheet = viz.getWorkbook().getActiveSheet().getWorksheets().get("Sheet 26");

                  sheet = viz.getWorkbook().getActiveSheet().getWorksheets().get("Test3");

                  // If the active sheet is not a dashboard, then you can just enter:

                  // viz.getWorkbook().getActiveSheet();

                  options = {

                      maxRows: 12, // Max rows to return. Use 0 to return all rows

                      ignoreAliases: false,

                      ignoreSelection: true,

                      includeAllColumns: false




                  sheet.getUnderlyingDataAsync(options).always(function (t) {

                      table = t;

                      var tgt = document.getElementById("dataTarget");

                      tgt.innerHTML = "<h4>Underlying Data:</h4><p>" + JSON.stringify(table.getData()) + "</p>";










      <body onload="initViz();">

          <div class="page-header">

              <h1>getData() Basic Example</h1>

              <p>Click the "Get Data" button to get underlying data for the viz.</p>

              <button id="getData" onclick="getUnderlyingData()" class="btn" disabled>Get Data</button>


          <div id="vizContainer" style="width:600px; height:600px;"></div>

          <div id="dataTarget"></div>