使用 WebQuery 类型的外部数据连接

使用 WebQuery 类型的外部数据连接

以下代码显示了如何处理类型为 WebQuery 的外部数据连接。它使用了您可以从提供的链接下载的 示例 Excel 文件。您还可以在下文看到此代码的控制台输出。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
Workbook workbook = new Workbook(dataDir + "WebQuerySample.xlsx");
ExternalConnection connection = workbook.DataConnections[0];
if (connection is WebQueryConnection)
{
WebQueryConnection webQuery = (WebQueryConnection)connection;
Console.WriteLine("Web Query URL: " + webQuery.Url);
}

控制台输出

这是上述代码与此 示例 Excel 文件 的控制台输出。

Web Query URL: https://docs.aspose.com/cells/net/