We have the following test file: IncorrectConnections.xlsx.zip (36.9 KB)
This file contains one query (aandelenratings) as can be seen in the “Queries & Connections” pane in Excel. In addition, it contains one hidden connection (ThisWorkbookDataModel) because a data model is present.
However, Aspose.Cells has three issues with this file:
(1) The workbook.DataConnections
collection returns three items, but two are expected
(2) The PowerQueryFormula
property is null for the connection that represents the query
(3) The ExternalConnection
property of the related query does not link to the connection that represents the query
It can be demonstrated by the following test code:
var workbook = new Workbook("IncorrectConnections.xlsx");
var connection = workbook.DataConnections[0];
Console.WriteLine(connection.Name); // ModelConnection_ExternalData_1, expected: not present
Console.WriteLine(connection.PowerQueryFormula);
connection = workbook.DataConnections[1];
Console.WriteLine(connection.Name); // Query - aandelenratings
Console.WriteLine(connection.PowerQueryFormula); // null, expected: not null
connection = workbook.DataConnections[2];
Console.WriteLine(connection.Name); // ThisWorkbookDataModel
Console.WriteLine(connection.PowerQueryFormula);
var table = workbook.Worksheets[0].QueryTables[0];
Console.WriteLine(table.ExternalConnection.Name); // ModelConnection_ExternalData_1, expected: Query - aandelenratings
Can you reproduce these issues and provide a fix? We’re using Aspose.Cells 24.11.0 for .NET.