InsertPivotExistingWorksheet

function InsertPivotExistingWorksheet(dataRef: ApiRange = null, pivotRef: ApiRange = null, confirmation: bool = null): ApiPivotTable

Description

Inserts PivotTable on existing worksheet.

Parameters

dataRefApiRangedefault: null

Source data range.

pivotRefApiRangedefault: null

Range in which the table will be located.

confirmationbooldefault: null

Replace the data in pivotRef (if it exists) or create a dialog box for this (if it exists).

Returns

ApiPivotTable

Try It

var oWorksheet = Api.GetActiveSheet();

oWorksheet.GetRange('B1').SetValue('Region');
oWorksheet.GetRange('C1').SetValue('Price');
oWorksheet.GetRange('B2').SetValue('East');
oWorksheet.GetRange('B3').SetValue('West');
oWorksheet.GetRange('C2').SetValue(42.5);
oWorksheet.GetRange('C3').SetValue(35.2);

var dataRef = Api.GetRange("'Sheet1'!$B$1:$C$3");
var pivotRef = oWorksheet.GetRange('A7');
var pivotTable = Api.InsertPivotExistingWorksheet(dataRef, pivotRef);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).