Hi,
I have an Excel file with 5 sheets. I want to convert that to XML so that it can be embedded as a resource file in my project. The XML file should have five tables (the five sheets) with all the values. Basically,
A database - XLS file name
Tables - XLS sheet names
Rows - Column headers
Columns - values
I made an extensive search in this forum and many others but I m afraid that was not very useful.
Any pointers on this would be appreciated
Thanks !!

Converting an excel file to XML
Wira Santos
And boban, So am I gonna create an XSD from the .Net IDE And how do I fill the dataset after reading the Excel file Using the OleDBAdapter But what will my select command be Imagining I dont even know the sheet names. And how will I map the sheets to the tables in the XSD Am really confused, I know it would be something easy but I am out of my mind now :(
Thanks again !!
Thumper1
Create an xsd schema with five elements (tables), add to each element all child elements (columns). Schema is a Dataset but with big control on xml format when you write to xml file. So you will have a Dataset that will have already a definitions of tables with columns, so all you have to do is to read excel file and fill tables in dataset.
At the end just execute WriteXml to create xml file.
You can find on web many articles of how to read excel file from C#.
Anton__
Yes you must use OleDbConnection. Check this site for reading excel file:
http://www.codeproject.com/csharp/Excel_using_OLEDB.asp
Filling dataset tables must be done manualy by code. That is for every table you should create row, then fill the row and then add that row to table. And that for all tables.
Importing data from different sources including excel files can be done also with help of SQL Server. If you use SQL 2000 then you can create that tables in database. Then create a Data Transformation Package that will connect to file, read and fill tables, and you will then read sql server tables. Executing such packages can be invoked programmatically.
SQL New
Hi,
Could you please try this link.
http://msdn.microsoft.com/office/program/excel/2003/reference/article/default.aspx pull=/library/en-us/dnofftalk/html/office05012006excel2003spreadsheetml.asp#office05012006excel2003spreadsheetml_whyusespreadsheetml
Hope this helps!
Thank you,
Bhanu.
Mark Gilbert