VOOZH about

URL: https://www.cdata.com/kb/tech/xml-odbc-power-automate.rst

⇱ How to Access Live XML Data in Power Automate Desktop via ODBC


How to Access Live XML Data in Power Automate Desktop via ODBC

πŸ‘ Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
The CData ODBC Driver for XML enables you to integrate XML data into workflows built using Microsoft Power Automate Desktop.

The CData ODBC Driver for XML enables you to access live XML data in workflow automation tools like Power Automate. This article shows how to integrate XML data into a simple workflow, moving XML data into a CSV file.

Through optimized data processing, CData ODBC Drivers offer unmatched performance for interacting with live XML data in Microsoft Power Automate. When you issue complex SQL queries from Power Automate to XML, the driver pushes supported SQL operations, like filters and aggregations, directly to XML and utilizes the embedded SQL engine to process unsupported operations client-side (e.g. SQL functions and JOIN operations).

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.

Connecting to Local or Cloud-Stored (Box, Google Drive, Amazon S3, SharePoint) XML Files

CData Drivers let you work with XML files stored locally and stored in cloud storage services like Box, Amazon S3, Google Drive, or SharePoint, right where they are.

Setting connection properties for local files

Set the URI property to local folder path.

Setting connection properties for files stored in Amazon S3

To connect to XML file(s) within Amazon S3, set the URI property to the URI of the Bucket and Folder where the intended XML files exist. In addition, at least set these properties:

  • AWSAccessKey: AWS Access Key (username)
  • AWSSecretKey: AWS Secret Key

Setting connection properties for files stored in Box

To connect to XML file(s) within Box, set the URI property to the URI of the folder that includes the intended XML file(s). Use the OAuth authentication method to connect to Box.

Dropbox

To connect to XML file(s) within Dropbox, set the URI proprerty to the URI of the folder that includes the intended XML file(s). Use the OAuth authentication method to connect to Dropbox. Either User Account or Service Account can be used to authenticate.

SharePoint Online (SOAP)

To connect to XML file(s) within SharePoint with SOAP Schema, set the URI proprerty to the URI of the document library that includes the intended XML file. Set User, Password, and StorageBaseURL.

SharePoint Online REST

To connect to XML file(s) within SharePoint with REST Schema, set the URI proprerty to the URI of the document library that includes the intended XML file. StorageBaseURL is optional. If not set, the driver will use the root drive. OAuth is used to authenticate.

Google Drive

To connect to XML file(s) within Google Drive, set the URI property to the URI of the folder that includes the intended XML file(s). Use the OAuth authentication method to connect and set InitiateOAuth to GETANDREFRESH.

The 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.

When you configure the DSN, you may also want to set the Max Rows connection property. This will limit the number of rows returned, which is especially helpful for improving performance when designing workflows.

Integrate XML Data into Power Automate Workflows

After configuring the DSN for XML, you are ready to integrate XML data into your Power Automate workflows. Open Microsoft Power Automate, add a new flow, and name the flow.

πŸ‘ A new flow in Power Automate

In the flow editor, you can add the actions to connect to XML, query XML using SQL, and write the query results to a CSV document.

Add an Open SQL Connection Action

Add an "Open SQL connection" action (Actions -> Database) and configure the properties.

  • Connection string: DSN=CData XML Source

After configuring the action, click Save.

πŸ‘ A configured 'Open SQL connection' action

Add an Execute SQL Statement Action

Add an "Execute SQL statement" action (Actions -> Database) and configure the properties.

  • Get connection by: SQL connection variable
  • SQL connection: %SQLConnection% (the variable from the "Open SQL connection" action above)
  • SQL statement: SELECT * FROM people

After configuring the action, click Save.

πŸ‘ A configured 'Execute SQL statement' action

Add a Write to CSV File Action

Add a "Write to CSV file" action (Actions -> File) and configure the properties.

  • Variable to write to: %QueryResult% (the variable from the "Execute SQL statement" action above)
  • File path: set to a file on disk
  • Configure Advanced settings as needed.

After configuring the action, click Save.

πŸ‘ A configured 'Write to CSV file' action

Add a Close SQL Connection Action

Add a "Close SQL connection" action (Actions -> Database) and configure the properties.

  • SQL Connection: %SQLConnection% (the variable from the "Open SQL connection" action above)

After configuring the action, click Save.

πŸ‘ A configured 'Close SQL connection' action

Save & Run the Flow

Once you have configured all the actions for the flow, click the disk icon to save the flow. Click the play icon to run the flow.

πŸ‘ A fully configured workflow

Now you have a workflow to move XML data into a CSV file.

πŸ‘ Application data in a CSV file (Salesforce is shown)

With the CData ODBC Driver for XML, you get live connectivity to XML data within your Microsoft Power Automate workflows.

Related Power Automate Articles

This article explains how to use the CData ODBC Driver for XML with Power Automate Desktop. Check out our other articles for more ways to work with Power Automate (Desktop & Online):

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.