0

I would like to read the worksheet name into getSummaryDataAsync function. Is it possible to read the calling object? worksheet.getName() has the last value of loop when the async call returns. How to pass the right value?

worksheets{"a","b","c"}

for (var i = 0; i < worksheets.length; i++) {
  var worksheet = worksheets[i];
  worksheet.getSummaryDataAsync({ maxRows: 1 }).then(
    function(sumdata) {
      if (sumdata.getTotalRowCount() > 0) {
        console.log(worksheet.getName() ); //the loop is already at c.
      }
    });
}

https://tableau.github.io/extensions-api/docs/interfaces/worksheet.html

Fabian
  • 1
  • 1

0 Answers0