By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,276 Members | 1,359 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,276 IT Pros & Developers. It's quick & easy.

Convert excel file to xml

P: n/a
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

May 16 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

May 16 '06 #2

P: n/a
Hi

Try this link.You might find it useful
http://www.codeproject.com/csharp/Excel2XML.asp

Regards
Naresh

"noopathan" wrote:
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

May 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.