Skip to content

getRange

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

getRange (range, asGrid, calculationId )

Arguments

range

(Required)

The range to return. This can be any of the following:

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

asGrid

Whether the results returned should be grid style (as in Excel) or a key/value pair (cell reference and value)

Default value: false

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 calculation.

Return

asGrid=false return value (JSON):

{
  "R1C1" : "A1",
  "R1C2" : "B1",
  "R2C1" : "A2",
  "R2C2" : "B2"
}

asGrid=true return value (JSON):

{
  0 : [ "A1", "B1" ],
  1 : [ "A2", "B2" ]
}

Examples

//
// Example 1 - Retrieve range A1 from the current reports last calculation
//
var values1 = report.api.getRange("A1"); 

//
// Example 2 - Retrieve range A1:B3 from the current reports last calculation
//
var values2 = report.api.getRange("A1:B3");

//
// Example 3 - Retrieve range A1:B3 as a grid of data from the current reports last calculation
//
var values3 = report.api.getRange("A1:B3", true);

//
// Example 4 - Retrieve range A1:B3 as a grid of data from the calculationId 1232
//
var values4 = report.api.getRange("A1:B3", true, 1232);