Get External Connection Data Source of Pivot Table

How to Get External Connection Data Source of Pivot Table

Aspose.Cells for Node.js via C++ provides the ability to get the external connection data source of the pivot table. For this, the API provides the getExternalConnectionDataSource method of the PivotTable class. The getExternalConnectionDataSourcemethod returns the ExternalConnection object. The following code snippet demonstrates the use of the getExternalConnectionDataSource method to get the external connection data source of the pivot table.

Sample Code

const AsposeCells = require("aspose.cells.node");
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Source directory
var sourceDir = RunExamples.Get_SourceDirectory();
// Load sample file
var workbook = new AsposeCells.Workbook(sourceDir + "SamplePivotTableExternalConnection.xlsx");
var worksheet = workbook.getWorksheets().get(0);
// Get the pivot table
var pivotTable = worksheet.getPivotTables().get(0);
// Print External Connection Details
console.log("External Connection Data Source");
console.log("Name: " + pivotTable.getExternalConnectionDataSource().getName());
console.log("Type: " + pivotTable.getExternalConnectionDataSource().getType());

The source file used in the code snippet is attached for reference.

Source File