Convert excel file to xml

  • Thread starter Thread starter noopathan
  • Start date Start date
N

noopathan

Hi experts ,
I have an excel file in the below format

---------------------------------------------------------------------
CodeID CodeName Market Name Date
--------------------------------------------------------------------

1 Sample1 Market1 22/2/2004
--------------------------------------------------------------------
2 Sample2 Market2 22/2/2003
--------------------------------------------------------------------

and so on..................

I want to convert this excel file in to the following xml format



<From Excel>
<CodeId>1</CodeId>
<CodeName>sample1</CodeName>
<MarketName>market1</MarketName>
<Date>22/2/2004</Date>
</From Excel>

<From Excel>
<CodeId>2</CodeId>
<CodeName>sample2</CodeName>
<MarketName>market2</MarketName>
<Date>22/2/2005</Date>
</From Excel>


and likewise all the selected cells from the excel file.I want to
implement it using c#.

Can anyone give the ideas (preferrably sample source code), helpfull
links so that I can do this task successfully.

Early ideas are greatly appreciated as I am stuck with this............

Regards
Jango
 
Excell can export the data into XML format, you need to use VSTO/Automation
for this (googling to find samples of using Excel export and .NET), but the
schema of excell export may not suit you - you must decide how to cope with
this
There are several ways, but all based on XSLT transfomation
- use excell export to get xml file and then use XSLT to reformat xml
- use ADO/ODBC to connect to excell file, get data table and then convert
DataTable XML presentation into you own XML schema.

These ideas that just come into my mind. I'd use the second one.
Hi experts ,
I have an excel file in the below format

---------------------------------------------------------------------
CodeID CodeName Market Name Date
--------------------------------------------------------------------

1 Sample1 Market1 22/2/2004
--------------------------------------------------------------------
2 Sample2 Market2 22/2/2003
--------------------------------------------------------------------

and so on..................

I want to convert this excel file in to the following xml format



<From Excel>
<CodeId>1</CodeId>
<CodeName>sample1</CodeName>
<MarketName>market1</MarketName>
<Date>22/2/2004</Date>
</From Excel>

<From Excel>
<CodeId>2</CodeId>
<CodeName>sample2</CodeName>
<MarketName>market2</MarketName>
<Date>22/2/2005</Date>
</From Excel>


and likewise all the selected cells from the excel file.I want to
implement it using c#.

Can anyone give the ideas (preferrably sample source code), helpfull
links so that I can do this task successfully.

Early ideas are greatly appreciated as I am stuck with this............

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top