Skip to content

getCalculatedValues

The getCalculatedValues method calculates a report in the background and returns values from a range as a JavaScript string array.

Syntax

getCalculatedValues (reportName, range, queryString, isPrivate, publisher)

Arguments

reportName : string (required)

The name of the report to be calculated.

range : string (required)

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

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

queryString : string

Any additional query string arguments to be passed to the report for calculation.

Default value: ""

isPrivate : boolean

Specify if the report is private.

Default value: false

publisher : string

If it is a private report, specify the id of the user that published it.

Default value: ""

Return

The result of this function is a JavaScript string array.

Example

//
// Example 1 - Calculate the named public report and retrieve range A1
//
var values1 = report.api.getCalculatedValues("MyTestReport", "A1");

//
// Example 2 - Calculate the named public report and retrieve range A1:B3
//
var values2 = report.api.getCalculatedValues("MyTestReport", "A1:B3");

//
// Example 3 - Calculate the named public report with some query string parameters and retrieve range A1:B3
//
var queryString = "[Date].[Date].%26[2]&R1C3=Yesterday"
var values3 = report.api.getCalculatedValues("MyTestReport", "A1:B3", queryString);

//
// Example 4 - Calculate the named private report and retrieve range A1:B3
//
var values4 = report.api.getCalculatedValues("MyTestReport", "A1:B3", "", true, "sgibbs");