• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

xls to xml conversion application

 
Ranch Hand
Posts: 842
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a xls file with two sheets namely sheet1 and sheet2

sheet 1 having 3 columns say

1. product 2. total 3. cost
has about 100 records


sheet2 also having same 3 columns say

1. product 2. total 3. cost
has about 10 records.

I need to convert above xls to xml with similar structure as follows


<sheet1>
<product1>
<product></product>
<total></total>
<cost></cost>
</product1>
<product2>
<product></product>
<total></total>
<cost></cost>
</product2>
.....more products
</sheet1>

<sheet2>
<product1>
<product></product>
<total></total>
<cost></cost>
</product1>
<product2>
<product></product>
<total></total>
<cost></cost>
</product2>
.....more products
</sheet2>

what is the best way to achieve it. Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance



 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use Apache POI to read the file, and then use any number of XML APIs to write it, like DOM, JDom, XOM etc.
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic