Friday, January 26, 2018

Connect to an XML file (Power Query)

Connect to an XML file (Power Query)

Use Excel's Get & Transform (Power Query) experience to connect to an XML file.

  1. Click on the Data tab, then Get Data > From File > From XML. If you don't see the Get Data button, click New Query > From File > From XML.

  2. In the From XML Browse dialog box, browse for or type a file URL to import or link to a file.

  3. Click Open.

    After the connection succeeds, you will be able to use the Navigator pane to browse and preview the collections of items in the XML file in a tabular form.

  1. In the Power Query ribbon tab, click From File > From XML.

    Power Query From File dialog
  2. In the From XML Browse dialog box, browse for or type a file URL to import or link to a file.

  3. Click Open.

    After the connection succeeds, you will be able to use the Navigator pane to browse and preview the collections of items in the XML file in a tabular form.

Important: Make sure you have downloaded and installed the Power Query Add-In.

Note: Power Query isn't supported in Excel 2007, but you can use the Get External Data method to import XML data.

  1. Click on the Data tab, then Get External Data > From Other Sources > From XML.

  2. In the Select Data Source dialog box, browse for or type a file URL to import, or choose the New Source option to link to a file.

Formula Example

You can also use the Query Editor to write formulas for Power Query. For example:

= Xml.Tables(File.Contents("C:\Downloads\XML Example.xml"))

Note: The Query Editor only appears when you load, edit, or create a new query using Power Query. The following video shows the Query Editor window appearing after editing a query from an Excel workbook. To view the Query Editor without loading or editing an existing workbook query, from the Get External Data section in the Power Query ribbon tab, select From Other Sources > Blank Query. The following video shows one way to display the Query Editor.

How to see Query Editor in Excel

Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.

See Also

Power Query is known as Get & Transform in Excel 2016

Import data from external data sources

No comments:

Post a Comment