Get External Connection Data Source of Pivot Table
How to Get External Connection Data Source of Pivot Table
Aspose.Cells for Python via .NET provides the ability to get the external connection data source of the pivot table. For this, the API provides the external_connection_data_source property of the PivotTable class. The external_connection_data_source property returns the ExternalConnection object. The following code snippet demonstrates the use of the PivotTable.external_connection_data_source property to get the external connection data source of the pivot table.
Sample Code
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Source directory | |
sourceDir = RunExamples.Get_SourceDirectory() | |
# Load sample file | |
workbook = Workbook(sourceDir + "SamplePivotTableExternalConnection.xlsx") | |
worksheet = workbook.worksheets[0] | |
# Get the pivot table | |
pivotTable = worksheet.pivot_tables[0] | |
# Print External Connection Details | |
print("External Connection Data Source") | |
print("Name: " + pivotTable.external_connection_data_source.name) | |
print("Type: " + str(pivotTable.external_connection_data_source.type)) |
The source file used in the code snippet is attached for reference.