Patrick\’s Bytes

14, January 2008

Excel mapping to XML Schema

Filed under: Excel,OpenXML — patrickyong @ 7:23 am

While OpenXML’s WordProcessingML has the capability to attach a custom XML instance and data bind with Content Controls, Excel achieve similar goal (similar only, not exactly) by attaching a XML schema (from xl\xmlMaps.xml file) and have xpath mapping to cells. Please refer to my previous post, I can even map a sequence of XML elements as a table in Excel. This post is more like a beginner’s guide to how all this work.

1. Enable Developer tab in the Ribbon UX. Click on the Office button and open Excel options.


2. Click on the Popular tab, and check "Show


Now the Developer is visible


3. Now click on the Source button to open up the XML Source task pane on the right.


4. Click on the XML Maps button on the bottom to open up XML Maps window


5. The click on Add button and attach the XML Schema (.xsd) file you want.


6. Click OK at XML Maps window and you will see the XML Source task pane XML tree got populated with the elements of your XML schema.


7.  To map the elements onto the Excel sheet, I just drag and drop the elements onto the cell. Should I want to add the item list as a table, I drag the item over.


8. Let me populate the sheet with some data.


9. Now to export the data I key in just now as a XML instance of Claims, click on the Export button on the Developer tab.


10. Give a proper name to the XML file in the Save dialog, then open it with IE.


Wala!! You can see data in the XML file is same as the one in Excel. So you can export this XML instance to any Line of Business application for data processing.


  1. hi patrick,

    That is a very good example you have given.

    here i have a question related to mapping to List to lists mapping to xml.
    let take a practical e.g. we have a purchase order with multiple line item.

    name: VENDOR1
    date: 1/2/2009

    quantity :: 5
    rate :: 10.00
    amount :: 50.00

    quantity :: 5
    rate :: 10.00
    amount :: 50.00

    how are we going to do the mapping to it.

    this is the xml code that i have written.




    hope you can guide me.will be of great help.


    Comment by Abhilash — 25, February 2009 @ 2:17 pm | Reply

  2. Hey Patrick,

    Thanks for the example above. I have a quick question though: When I export from Excel to XML, the date format (mm/dd/yyyy) converts to a serial date format (ex: 40449). I suppose the difference between your example and my file is that I applied the mapping to an existing Excel file rather than starting from scratch.

    How did you maintain the date format into XML?



    Comment by K.C. — 11, November 2010 @ 1:05 am | Reply

  3. How to Export Schema from Excel 2007?

    Comment by Rakesh — 10, October 2012 @ 4:28 pm | Reply

  4. Great Thanks for update this information!!

    Comment by Mubarak — 19, July 2013 @ 4:56 pm | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: