Retrieving SQL Connection Data

[ ]

In Microsoft Excel, connect to a database by:

  1. Clicking the Data menu and selecting From Other Sources followed by From SQL Server.
  2. Then select Data followed by Connections.
  3. Use the Connections wizard to connect to the database and create a database query.

Showing the SQL connection option in Microsoft Excel


Aspose.Cells provides the Workbook.getDataConnections() method for retrieving external connections. It returns a collection of ExternalConnection objects in the workbook.

If the ExternalConnection object contains SQL connection data, it can be type-caste into a DBConnection object its properties used to retrieve database command, command type, connection description, connection info, credentials, and so on.