473,597 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert excel file to xml

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>sampl e1</CodeName>
<MarketName>mar ket1</MarketName>
<Date>22/2/2004</Date>
</From Excel>

<From Excel>
<CodeId>2</CodeId>
<CodeName>sampl e2</CodeName>
<MarketName>mar ket2</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
2 8533
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>sampl e1</CodeName>
<MarketName>mar ket1</MarketName>
<Date>22/2/2004</Date>
</From Excel>

<From Excel>
<CodeId>2</CodeId>
<CodeName>sampl e2</CodeName>
<MarketName>mar ket2</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
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>sampl e1</CodeName>
<MarketName>mar ket1</MarketName>
<Date>22/2/2004</Date>
</From Excel>

<From Excel>
<CodeId>2</CodeId>
<CodeName>sampl e2</CodeName>
<MarketName>mar ket2</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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
17998
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript function and have JS put this into an array. Then JS would use this array to create a selection list which displays only the names of the drugs. When the user selections one of the drugs, another selection list will be loaded with the avaiable...
0
2079
by: Alex | last post by:
i have a module in Access which opens an existing Excel file and envokes a macro within the Excel file to draw graphs. now i am trying to convert the Excel macro to an Access one so that the converted Access macro can do the same thing as the Excel macro does when i open the Excel file. Can anybody give me a hint? Thanks in advance! Alex
3
4247
by: Steve | last post by:
Using VB.NET, How do I convert a .txt file extension to a .xls file extension? The text file is already created and saved in a folder on the server. Thanks Steven
8
19302
by: pappu | last post by:
Hello friends, I want to convert .xls file into text file.So can anybody pls help me out. Thxxxxxx, Sachin.
3
6512
by: Alain R. | last post by:
Hi, I have an excel file with charset "windows-1250" and i would like to convert it to CSV file with charset "UTF-8" how can i do that ? thanks a lot, Al.
2
5181
budigila
by: budigila | last post by:
Hiya peeps, Okies, I have been trying to work this out for a while now to no avail... I am a beginner to this whole coding thing but have made great strides in my project. Basically what I am trying to do is to convert an .xml using a .xsl to and using a java script to output it into a readable format within excel. I have been able to successfully use a javascript to combine my .xml and .xsl but cannot figure out how to have it output to...
32
10937
by: poolboi | last post by:
hi guys, i've read a lot of thread of converting excel data into CSV files. however, i need a perl script to convert CSV file into excel file now, if required modules is needed, it would be preferable if win32::OLE is used.. currently what i know is when i change my extension as .csv file mannually, it get changed to an excel file through Microsoft Excel CSV file so if i were to use a perl script and convert the perl script has to...
0
1769
by: Raymond Chiu | last post by:
Dear all, In my vb.net program, I am using excel object to create excel file and stored in a folder. How can it be converted to be pdf file automatically using dotnet coding or others? Actually I have some ideas but no sure in detail (1) If IIS Server installed pdf printer, then using windows object to print excel file through pdf printer and save as pdf file in a folder. How the code should be? (2) Install the software in IIS which...
15
17364
by: pakerly | last post by:
How would i do this, convert a test file to excel? Lets say my text file has fields like this: NUMBER NAME ADDRESS PHONE 11002 Test1 TestAddress1 111-2222 lets say the number field is 10 characters long, there is a space and Name field is 15 characters long, there is a space, address can be 25 characters long, there is a space and phone is 10 characters long I want to...
0
7969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7886
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8272
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3927
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2404
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.