getRanges

This function allows you to call to another report, calculate it in the background without rendering it to the user and return the values from a given range.

Syntax

getRanges (range, calculationId )

Arguments

ranges

(Required)

This argument is an array of ranges to return. A range can be specified in any of the following formats:

  • A1 reference
  • R1C1 reference
  • A1:B6 reference
  • Named range

The format of this argument is a JavaScript string array:

 ["A1:B2", "G3:H7"]

calculationId

If empty, this will get the range values being asked for from the current reports last calculation.

If an id is specified, then it will use the results from that calclation.

Return

The result of this will be a JSON object that has the following sample structure:

{ 
  "R1C1" : "123",
  "R1C2" : "Hello",
  "R2C1" : "$12,000.00",
}

Examples

//
// Example 1 - Retrieve ranges A1:B5 and the Named Range 'MyNamedRange' from current reports last calculation
//
var values1 = report.api.getRanges(["A1:B5", "MyNamedRange"]); 

//
// Example 2 - Calculate another report and then retrieve ranges A1:B5 and the Named Range 'MyNamedRange' from it
//
var calcId = report.api.getCalculationId("MyTestReport");
var values2 = report.api.getRanges(["A1:B5", "MyNamedRange"], calcId);