Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

how to create the textfiles based on excel sheet content using java

hi

i have one excel sheet it contains two columns
one column contains exachange id
another column contains requested xml

from this excel sheet i have to create txt files
by using exchange id i have to create txtfilename
this file containss second column request xml data

how many exchangeids are there in excel sheet those many txt files i have to create
and insert request xmls into it.

can any one suggest how to do it using java

Thanks
Avatar of gheist
gheist
Flag of Belgium image

Excel sheet can serve as a java data source via ODBC-JDBC bridge.
Avatar of srikotesh
srikotesh

ASKER

i know how to read the data from excel sheet using java program
after that i have create txt file and i have to add xml into it.
Avatar of awking00
Can you show a few sample rows from your spreadsheet and, using those rows, create the text file you would like as a result?
Really do need to see a sample of the workbook. Is there only one worksheet? Do you want a text file for each xml value in the spreadsheet? Are there headers in the worksheet? Is there any modification to the xml required? Are you looking to create files with .txt extensions or with .xml extensions? I do a lot of this stuff (mostly in the other direction - xml to xls, though) and just need to get a clearer picture of what you need.
Do you still need help with this?
HI awking00,

Sorry for the delay,
yes i need help please see the attached excel sheet.
REQUEST-XML.xlsx
please see my answers for your questions

Do you want a text file for each xml value in the spreadsheet?
yes i need a txt file for each xml

Are you looking to create files with .txt extensions or with .xml extensions?
i am looking for .txt extension
ASKER CERTIFIED SOLUTION
Avatar of awking00
awking00
Flag of United States of America image

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
while running this program i am getting the below exception
i tried with .xls and .xlsx formats but still i am getting this error

java.lang.NoClassDefFoundError: InvalidFormatException
Caused by: java.lang.ClassNotFoundException: InvalidFormatException
above issue is resolved now i am gettting
java.lang.ArrayIndexOutOfBoundsException: 0
      at com.org.XMLFileConverter.main(XMLFileConverter.java:25)
SOLUTION
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
I've requested that this question be closed as follows:

Accepted answer: 0 points for srikotesh's comment #a40517468

for the following reason:

I got the proper solution what i am looking.Thx
Could you point us to the answer that is the "proper solution", or detail different approach you took?
>>I got the proper solution what i am looking.<<
Can you please post the "proper solution"?
hi awking00,

whatever u gave the code that works for me
after removing the line
String xlsFilename = args[0]; from the above code.
Thanks for u suggestions