tags:

views:

258

answers:

4

Hi,

I need code in java for Excel to XML conversion. where Excel sheet will be used as the input file and XML file as the output file.we have to read the Excel file Row and column wise and than write that data to XMl file.

please anybody give any Code or URL or any Repository of example,which would be appreciated.

Thanks,

Mishal Shah

+2  A: 

Have a look at Apache POI. I'm sure there are some examples there.

Francis Upton
+1  A: 

JExcel is another option, although I think it has less features and doesn't support the latest excel format like the Apache POI does.

Herminator
+1  A: 

This may not be the answer you were looking for, but Excel already has built-in support for XML. If you are using Excel 2007, you will need to enable the Developer tab on the ribbon. From there you can import and export XML schemas and files.

To enable the developer tab:

  1. Click the Microsoft button...

    Microsoft Button

  2. Click Excel Options

  3. Check "Show Developer Tab in the Ribbon"

You will need to create a map by either importing an example XML file that is in the same format as the one you'd like to export, or you can click Source and use a schema (XSD) file.

From there, you just need to map the elements in your XML Map to the data in your sheet, then export the data to an XML file.

DanM
A: 

I did a "Read Excel into a DefaultTableModel" in about 20 lines with the JExcel API. It was very nice and simple to use.

Thorbjørn Ravn Andersen