Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Sep 28, 2021 6:46 am

Hi Team,

Is it possible to get Excel (Macro Enabled) Queries and Connection.

Example :

Get All =>
a) connection from an Excel sheet
b) Queries from an Excel Sheet

Have a great day

lijgeorge
 
Posts: 15
Joined: Fri Sep 04, 2020 9:53 am

Tue Sep 28, 2021 10:54 am

Hello,

Thank you for your inquiry.
Actually the "Queries and Connections" applies the external data source, sorry to tell that our Spire.XLS doesn't support getting the external data source at present. But if you want to get the data which references "Queries and Connections" in sheet, you could use the code below to get the cell data. If there is any question, please feel free to write back.
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile(inputFile);
//Traverse all worksheets 
foreach (Worksheet worksheet in workbook.Worksheets)
{
    for (int i = 0; i < worksheet.Rows.Length;i++)
    {
        for (int j = 0; j < worksheet.Rows[i].Columns.Length;j++)
        {
            CellRange cell = worksheet.Rows[i].Columns[j];
            //Get cell content
            string values = cell.Value;
        }
    }
}

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Tue Sep 28, 2021 12:15 pm

Hi Annika,

Thank you for the quick response. Appreciate it.

Thank You
Lijo George

lijgeorge
 
Posts: 15
Joined: Fri Sep 04, 2020 9:53 am

Wed Sep 29, 2021 2:20 am

Hi,

You're welcome.
If you have any other question related to our products, just feel free to contact us!

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS