Working with External Data Connection of type WebQuery

Working with External Data Connection of type WebQuery

The following code shows how to work with external data connection of type WebQuery. It uses the sample excel file which you can download from the provided link. You can also see the console output of this code further below.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(WorkingWithExternalDataConnection.class);
Workbook workbook = new Workbook(dataDir + "WebQuerySample.xlsx");
ExternalConnection connection = workbook.getDataConnections().get(0);
if (connection instanceof WebQueryConnection)
{
WebQueryConnection webQuery = (WebQueryConnection)connection;
System.out.println("Web Query URL: " + webQuery.getUrl());
}

Console Output

Here is the console output of the above code with this sample excel file.

 Web Query URL: http://www.aspose.com/docs/display/cellsnet/Home