Link to home
Start Free TrialLog in
Avatar of Justin
Justin

asked on

How to convertan Excel file into XML

Hi, I have to convert on a daily basis an Excel file to XML. Can someone guide me into how to do the attached?
Murex_02June2016.xlsx
Avatar of jitendra patil
jitendra patil
Flag of India image

please refer the below link it will help you generate your xml file.

Excel to XML Conversion in Visual Studio
you can get a downloadable version at below link
How to Convert excel file to xml format (CSOpenXmlExcelToXml)
hope this helps.
Avatar of Professor J
Professor J

@JCutcliffe

you will very much like my solution as attached. simple as this.


please open this file and then choose the path to export the XML file and click ok and it is done.

i acknowledging part of code from Raymond Pang from Codeproject.

please let me know.
EE.xlsm
Avatar of Justin

ASKER

Which button do you use "Process using GenearteXMLObj" or "Process using fGenerateXML"? Also, do I have to type the file path in the "Export to Following file" field as when I click on "Browse" nothing happens?
please use Process using fGenerateXML

also the file path is default where the workbook is saved itself.  you can change the file path by typying there. i did not work on the browse icon.
Avatar of Justin

ASKER

I did it but all that came out in the xml file was "<?xml version="1.0"?>
<data> </data>"
Copy-of-EE.xlsm
Avatar of Justin

ASKER

Any ideas?
becuase your header should have a back slash and also the DATA prefix.  like this /Data/TRADER

The selected region on excel sheet, with the first row as field name, and data rows below
  For the field name, use the node delimiter "/" to build the hierarchy of data e.g. /data/TRADER is equvalent to <data><TRADER>....</TRADER><data>
Avatar of Justin

ASKER

So I just have to edit the first row then, eg. "Nominal" changes to "/Data/Nominal" ?
Avatar of Justin

ASKER

It works! Is there a way to bring up the Macros buttons whilst still in the file instead of closing and opening the file to get the Macro buttons?
yes.


insert a new module and put this code.

Sub Test()

Startform.show

End Sub

Open in new window


then either assign a shortcut key or run the Test macro and it will bring up that form
Avatar of Justin

ASKER

Just ran it and it said Run-time error '424' Object required. I assigned a Macro button from Design Mode in the Developer ribbon to it.Any ideas?
can you please send me your latest file and i will build on it.
Just a comment. I don't think this will totally help your situation, but just so you know, Excel files are compressed XML files. Just open with decompression program like 7-zip and you may be out to a good start.
Avatar of Justin

ASKER

here you go. Can you get rid of that "Excel warning message about sharing personal information too?
MUREX-2ND-JUNE.xlsm
ASKER CERTIFIED SOLUTION
Avatar of Professor J
Professor J

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Justin

ASKER

Excellent