Results 1 to 2 of 2
  1. #1
    syntel is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default Need to read an excel file and print it as an xml

    Hi all,

    I have a requirement in my project for which i need some guidance.I have an excel sheet something similar to this .Please note that in the first 2 rows the columns "id" and "Name" have the same values but hobbies are different.

    id Name Hobbies
    1 Xxx Reading
    1 Xxx Movies
    2 Yyy Singing
    3 Zzz Stamp collection
    3 Zzz Sports

    Now i want this to be converted to an xml which would look something similar to this:

    <person>
    <id>1</id>
    <Name>Xxx</Name>
    <Hobbies>Reading</Hobbies>
    <Hobbies>Movies</Hobbies>
    </person>

    I want the id and Name to be taken only once but the hobbies(which is repeated in the excel) should be repeated in the xml for that particular id.

    Can someone tell me how to achieve this in Java?

    Thanks.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,439
    Rep Power
    18

    Default

    POI (or JExcel) to read the excel.
    Write down your logic for what to do as you cycle down the rows, which will vary depending on if the Excel is ordered or not.
    Try and aim to write out the XML as you're traversing the excel rows, if at all possible.

Similar Threads

  1. Excel file read error
    By Asvin in forum New To Java
    Replies: 10
    Last Post: 04-28-2011, 10:01 PM
  2. How to read Excel file in java
    By nagaraj in forum New To Java
    Replies: 7
    Last Post: 03-18-2011, 05:09 AM
  3. how to read excel file through java program
    By madhuragowda in forum New To Java
    Replies: 2
    Last Post: 04-16-2010, 08:53 AM
  4. How to Read Excel file??
    By spalax in forum New To Java
    Replies: 3
    Last Post: 08-15-2009, 05:06 AM
  5. How to read Excel file with java
    By chetan-24 in forum New To Java
    Replies: 5
    Last Post: 04-22-2009, 05:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •