Ready to get started?

Download a free trial of the XML ODBC Driver to get started:

 Download Now

Learn more:

XML Documents Icon XML ODBC Driver

The XML ODBC Driver is a powerful tool that allows you to connect with live XML data stores, directly from any applications that support ODBC connectivity.

Access XML data like you would any standard database - read, write, and update etc. through a standard ODBC Driver interface.

Use the CData ODBC Driver for XML in Microsoft Power Query



You can use the CData XML ODBC Driver with Microsoft Power Query. In this article, you will use the ODBC driver to import XML data into Microsoft Power Query.

The CData ODBC Driver for XML enables you to link to XML data in Microsoft Power Query, ensuring that you see any updates. This article details how to use the ODBC driver to import XML data into Microsoft Power Query.

Connect to XML as an ODBC Data Source

If you have not already, first specify connection properties in an ODBC DSN (data source name). This is the last step of the driver installation. You can use the Microsoft ODBC Data Source Administrator to create and configure ODBC DSNs.

See the Getting Started chapter in the data provider documentation to authenticate to your data source: The data provider models XML APIs as bidirectional database tables and XML files as read-only views (local files, files stored on popular cloud services, and FTP servers). The major authentication schemes are supported, including HTTP Basic, Digest, NTLM, OAuth, and FTP. See the Getting Started chapter in the data provider documentation for authentication guides.

After setting the URI and providing any authentication values, set DataModel to more closely match the data representation to the structure of your data.

The DataModel property is the controlling property over how your data is represented into tables and toggles the following basic configurations.

  • Document (default): Model a top-level, document view of your XML data. The data provider returns nested elements as aggregates of data.
  • FlattenedDocuments: Implicitly join nested documents and their parents into a single table.
  • Relational: Return individual, related tables from hierarchical data. The tables contain a primary key and a foreign key that links to the parent document.

See the Modeling XML Data chapter for more information on configuring the relational representation. You will also find the sample data used in the following examples. The data includes entries for people, the cars they own, and various maintenance services performed on those cars.

Import XML Data

Follow the steps below to import XML data using standard SQL:

  1. From the ribbon in Excel, click Power Query -> From Other Data Sources -> From ODBC.

  2. Enter the ODBC connection string. Below is a connection string using the default DSN created when you install the driver: Provider=MSDASQL.1;Persist Security Info=False;DSN=CData XML Source
  3. Enter the SELECT statement to import data with. For example:

    SELECT [people].[personal.age] AS age, [people].[personal.gender] AS gender, [people].[personal.name.first] AS first_name, [people].[personal.name.last] AS last_name, [vehicles].[model], FROM [people] JOIN [vehicles] ON [people].[_id] = [vehicles].[people_id]
  4. Enter credentials, if required, and click Connect. The results of the query are displayed in the Query Editor Preview. You can combine queries from other data sources or refine the data with Power Query formulas. To load the query to the worksheet, click the Close and Load button.