Use XML Maps

If all of the XSLT in the preceding sections intimidated you, relax a bit. Excel also provides graphical tools for importing XML into workbooks through XML maps. XML maps are the way Excel represents XML schemas within a workbook. Excel can generate these maps from the structure of an imported XML file, or Excel can load an XML schema as an XML map.

Excel uses XML maps as a way to bind data from an XML file to cells and list columns on a worksheet. You create this binding by selecting items from an XML map displayed in the XML Source task pane and dragging them to locations on a worksheet.


You don’t have to know XSLT to read or write XML from Excel. XML maps let you work with XML at a higher level and ignore some of the complexities.

How it works

To see how this works, follow these steps:

  1. Open the sample file SimpleOrder.xml in Excel using the regular File Open menu. Excel displays the Open XML dialog box (Figure 3-5).

    The Open XML dialog box

    Figure 3-5. The Open XML dialog box

  2. Select the Use the XML source task pane option and click OK. Excel creates a new, blank workbook and informs you that the file did not contain a schema (Figure 3-6), so Excel will infer one from the XML.

    Excel inferring a schema for you

    Figure 3-6. Excel inferring a schema for you

  3. Click OK. Excel displays the XML map it created in the task pane ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.