Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
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.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace Aspose::Cells::ExternalConnections;
int main()
{
Aspose::Cells::Startup();
// Source directory path
U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
// Path of input excel file
U16String inputFilePath = srcDir + u"WebQuerySample.xlsx";
// Create workbook
Workbook workbook(inputFilePath);
// Get the first external connection from the workbook
ExternalConnection connection = workbook.GetDataConnections().Get(0);
// Check if the connection is a WebQueryConnection
if (connection.GetClassType() == ExternalConnectionClassType::WebQuery)
{
// Cast to WebQueryConnection
WebQueryConnection webQuery(connection);
// Print the URL of the web query
std::cout << "Web Query URL: " << webQuery.GetUrl().ToUtf8() << std::endl;
}
Aspose::Cells::Cleanup();
}
Here is the console output of the above code with this sample excel file.
Web Query URL: https://docs.aspose.com/cells/net/Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.