Solved

Convert Excel to XML

Posted on 2011-02-22
10
526 Views
Last Modified: 2012-05-11
Hi

It will be my first time but I need to upload a Excel sheet and convert it to a XML is SSIS. Is there some references
0
Comment
Question by:abooysen2
  • 7
  • 2
10 Comments
 
LVL 4

Expert Comment

by:h3nnys
ID: 34950761
0
 

Author Comment

by:abooysen2
ID: 34950799
The requirement is I have to do it in SSIS
0
 
LVL 4

Expert Comment

by:h3nnys
ID: 34950882
If you have a well formatted xls document then there is no reason to convert it to xml all you need to do is import the xls document into ssis.
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:abooysen2
ID: 34951027
Well users will drop it on a share and I SSIS package will need to pick up the Excel sheet that the users dropped.
0
 
LVL 17

Expert Comment

by:Sikhumbuzo Ntsada
ID: 34951158
If you have excel, open the file and save it as in xml format and upload it, everything should work.
0
 

Author Comment

by:abooysen2
ID: 34951465
Can I not upload the Excel and then convert it to XML. Because I already propose that and they want to save it to a excel file
0
 

Author Comment

by:abooysen2
ID: 34951755
I tried this VB code but it does not work

         Dim dt As New DataTable()
        Dim ds As New DataSet
        dt.Columns.Add("Currency", String.Empty.GetType())
        dt.Columns.Add("Legal Entity", String.Empty.GetType())
        dt.Columns.Add("Account id", String.Empty.GetType())
        dt.Columns.Add("Movement", String.Empty.GetType())
        dt.Columns.Add("Value date", String.Empty.GetType())
        dt.Columns.Add("Narration", String.Empty.GetType())
        dt.Columns.Add("Counterparty", String.Empty.GetType())
        ds.Tables.Add(dt)
        Dim FILE_NAME As String = "C:\Users\anthonio.booysen\xmltest.xml"
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
        objWriter.Write(ds.GetXml)
        objWriter.Close()
0
 

Accepted Solution

by:
abooysen2 earned 0 total points
ID: 34958790
Hi now can extract my data in a xml but i need for for loop can you perhaps assist
writer.WriteStartDocument()

        ' Add elements to the file.
        writer.WriteStartElement("transferupload")
        writer.WriteStartElement("Currency", "")
        writer.WriteString(Row.Currency.ToString)
        writer.WriteEndElement()
        writer.WriteStartElement("Legal Entity", "")
        writer.WriteString(Row.LegalEntity.ToString)
        writer.WriteEndElement()
        writer.WriteStartElement("Accountid", "")
        writer.WriteString(Row.Accountid.ToString)
        writer.WriteEndElement()
        writer.WriteStartElement("Movement", "")
        writer.WriteString(Row.Movement.ToString)
        writer.WriteEndElement()
        writer.WriteStartElement("Value Date", "")
        writer.WriteString(Row.Valuedate.ToString)
        writer.WriteEndElement()
        writer.WriteStartElement("Narration", "")
        writer.WriteString(Row.Narration.ToString)
        writer.WriteEndElement()
        writer.WriteStartElement("Counterparty", "")
        writer.WriteString(Row.Counterparty.ToString)
        writer.WriteEndElement()



        ' Ends the document 
        writer.WriteEndDocument()
        writer.Close()

Open in new window

0
 

Author Comment

by:abooysen2
ID: 35067638
I manage to get this to work. Took a long time but it works
0
 

Author Closing Comment

by:abooysen2
ID: 35120542
I manage to get this to work. Took a long time but it works
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to join on ID, with prefix? 15 58
SQL Query including math and 2 tables problem 26 50
SQL Sub-Query Help 22 62
Email Notifications for SQL 2005 9 27
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question