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

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

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

from aspose import pycore
from aspose.cells import Workbook
from aspose.cells.externalconnections import WebQueryConnection
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
workbook = Workbook(dataDir + "WebQuerySample.xlsx")
connection = workbook.data_connections[0]
if connection is WebQueryConnection:
webQuery = pycore.cast(WebQueryConnection, connection)
print("Web Query URL: " + webQuery.url)

控制台输出

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

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