Chapter 3. Work with XML

As you may have realized from the previous chapter, lists are one of the ways Excel handles XML data. Shared lists are stored as XML, SharePoint exchanges updates via XML Web services, and lists can import and export XML.

I didn’t address XML directly in the preceding chapter because lists are just one of the ways Excel handles XML. In this chapter I show the different ways you can work with XML in Excel. Specifically, I show you how to:

  • Save a workbook as XML

  • Transform XML from a workbook into other forms of output

  • Transform a non-Excel XML file into an XML Spreadsheet

  • Import XML to a list

  • Export XML from a list

  • Create templates for XML

  • Respond to XML import and export events

  • Program with the XML Map objects

  • Bind lists and ranges to XML data sources

Speak XML

Simply put, XML is a way to store data as plain text. This useful because it allows all sorts of hardware and software to exchange data and, more importantly, understand that data. If Office 2003’s goal is integration, then XML is the means to accomplish that goal.

Excel 2003 supports XML at two levels:

  • The XML spreadsheet file format lets you save and open Excel workbooks stored as plain text in XML format.

  • Lists and XML Maps let you import and export XML to a range of cells in a worksheet.

Note

Code used in this chapter and additional samples are available in ch03.xls.

How it works

The concept behind XML has been around for a very long time. The core idea is that if you store content in plain text, ...

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.