tags:

views:

55

answers:

2

How would I go about converting an Excel file to an XML document using C#?

+2  A: 

The newer Office formats are XML documents anyway (if your Excel saves as "xlsx" then it's saving as an XML document).

(If that's not enough, you should perhaps explain what kind of XML schema you're looking for.)

Dan Puzey
Actually, for clarity sake: .xlsx is a `ZIP` file with many `xml` documents inside it.
Aren
Apologies. I need to save the xml to disk after conversion.
ryan
Which Xml? As stated, a (new-version) office file contains an xml document anyway; if you've saved that to disk then you've saved the xml to disk. You still haven't explained what your xml document is expected to contain...
Dan Puzey
+2  A: 

You may use the .NET framework to do so. I quick google search got me this example that demonstrates how to read an Excel sheet. Having stored your sheet in an object, you could serialize that object into XML as shown here.