Ravendra's Blog

October 29, 2009

How to convert XML Data into Excel

Filed under: Uncategorized — Ravendra Mishra @ 12:31 pm

using System;
using System.Data;
using System.IO;
using System.Xml;
using System.Xml.Xsl;
namespace XML2Excel
    class Program
        static void Main(string[] args)
            if (args.Length < 2)
                throw new Exception(“Usage: XML2Excel XMLFileName XSLName ExcelFileNameToCreate”);       

            DataSet ds = new DataSet();
            XmlDataDocument xdd = new XmlDataDocument(ds);
            XslTransform xt = new XslTransform();

            StreamWriter swriter = new StreamWriter(args[2]);
            xt.Transform(xdd, null, swriter.BaseStream);           


1 Comment »

  1. Hi there, You’ve done a great job. I will certainly digg it and personally suggest to my friends. I am sure they’ll be benefited from this site.

    Comment by George — December 2, 2012 @ 6:44 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:

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

Blog at WordPress.com.

%d bloggers like this: